Below is running program in python which accept input string from user. using for loop it is reversing the string.
# Sample python program to reverse string using for loop inputString = input('\n\nEnter string to perform reverse operation\t') reverseString='' #Declaring empty reverse string variable. for ch in inputString: reverseString = ch + reverseString print('Reverse of ' ,inputString, ' is =>',reverseString)
Enter string to perform reverse operation reverse Reverse of reverse is => esrever >>>