Write a Python program which reverse a string and store the reversed string in a new string
Answers
Answered by
0
Answer:
def str_reverse(str1):
reverse = " "
for I in str1:
reverse = i + reverse
return reverse
print (str_reverse(input("Enter Any name")))
Make sure the intendation
Answered by
1
Answer:
It is really easy to Write a Python program which reverse a string and store the reversed string in a new string.
Explanation:
This is the first method:
def reverse_string(string):
for i in range(len(string) - 1, -1, -1):
print(string[i], end="")
reverse_string("hello")
This is the second method:
def reverse_string(string):
print(string[::-1])
reverse_string("hello")
mark me as brailiest and pls like
Similar questions