1string = "something"
2
3slice = string[0:3] # will be "som"
4slice = string[0:-3] # will be "someth"
5slice = string[3:] # will be "thing"
6slice = string[:3] # same as first slice
7slice = string[::2] # will be "smtig" -- it goes 2 step each time
1my_string = "Hey, This is a sample text"
2print(my_string[2:]) #prints y, This is a sample text
3print(my_string[2:7]) #prints y, Th excluding the last index
4print(my_string[2::2]) #prints y hsi apetx
5print(my_string[::-1]) #reverses the string => txet elpmas a si sihT ,yeH