+ 3
How to reverse a string??
5 Antworten
+ 7
StringName=StringName[::-1] :-)
+ 7
print("".join(reversed(input())))
or
print(input()[::-1])
+ 5
It is better is to collect your substrings in a list, and join them later:
def reverse_a_string_more_slowly(a_string):
new_strings = []
index = len(a_string)
while index:
index -= 1 new_strings.append(a_string[index]) return ''.join(new_strings)
Though it's simple that when you'll learn about index you will get it easily! In simple language you can just use (-1) to reverse the input..
+ 1
Thanks
+ 1
Thank you all..