Write a program in python to reverse a string
Answers
Answered by
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
Environmental Sciences,
1 month ago
Math,
1 month ago
Math,
2 months ago
Biology,
2 months ago
Math,
10 months ago
World Languages,
10 months ago