mystring = "Hi Python" # Iterating through the string using while loop for i in mystring[-1: -7 : -1] : # Print all characters iterated print("Element of string:" , i)