Computer Science, asked by icebabby, 2 months ago

Write a program in python to reverse a string

Answers

Answered by amrikhoreAmrik
1

def reverse_string(str):

str1 = "" Declaring empty string to store the reversed string

for i in str:

str1 = i + str1

return str1 It will return the reverse string to the caller function

str = "JavaTpoint" Given String

print("The original string is: ",str)

print("The reverse string is",reverse_string(str)) # Function call

Similar questions