+ 4

How to reverse a word to the Python?

https://code.sololearn.com/c88SZWzbZqi3/?ref=app, i can't reverse the word, help

6th Nov 2020, 10:55 AM
Operand
Operand - avatar
4 Respostas
+ 10
You don't have to do all that ,simply do => word[::-1] #it reverses list items ,and since string is an array of char it applies to it as well ,
6th Nov 2020, 10:58 AM
Abhay
Abhay - avatar
+ 13
Not to forget that there is a reversed() function: string_ = "Hello world" print(''.join(reversed(string_)))
6th Nov 2020, 11:56 AM
Lothar
Lothar - avatar
6th Nov 2020, 11:34 AM
Sousou
Sousou - avatar
+ 1
string="Austine" reversed(string)
7th Nov 2020, 8:13 AM
Austine Samuel
Austine Samuel - avatar