String Slicing

Program
 
b="hari taraka prabhu welcome to python programming"

print("b is:",b)
print("                       ")
print("---------->>Slicing")
print("b[2:5] is:" , b[2:5])
print("                       ")

print("---------->>Slice From the Start")
print("b[:5] is :", b[:5])
print("                       ")

print("---------->>Slice From the end")
print("b[2:] is :", b[2:])
print("                       ")

print("---------->>negative indexing")
print("b[-5: -2] is :", b[-5:-2] )
print("                       ")

=========================================

Output:

b is: hari taraka prabhu welcome to python programming
                       
---------->>Slicing
b[2:5] is: ri 
                       
---------->>Slice From the Start
b[:5] is : hari 
                       
---------->>Slice From the end
b[2:] is : ri taraka prabhu welcome to python programming
                       
---------->>negative indexing
b[-5: -2] is : mmi