3. Write a python program generate a function to reverse the input value.
The output is:
input vale = Python3
Expected Answer:
The reverse of input: 3nohtyp
Sample Answer:
def input_reverse(string):
rstring = ''
len_string = len(string)
while len_string > 0:
rstring += string[len_string - 1]
len_string = len_string - 1
return rstring
print("The reverse of input:", input_reverse('python3'))
More Exercises:
Python String ExercisesMore Numpy Exercises:
Numpy String ExercisesMore Pandas Exercises:
Pandas Series ExercisesMore Tutorials:
Python Installation - Linux (Ubuntu)