0

How to get reverse output of a string using python?

28th Sep 2021, 6:45 PM
Aman Verma
2 Respostas
0
'abcd'[::-1]
28th Sep 2021, 6:48 PM
Arsalan [Inactive]
Arsalan [Inactive] - avatar
0
Hi! Maybe it’s a bit cumbersome, but you can even use: print("".join(reversed(s))) where ’s’ is a string and where ’reversed’ return an reversed iterator of s. ’join’ concatenate what ’reversed’ return without any spaces between the letters.
28th Sep 2021, 9:19 PM
Per Bratthammar
Per Bratthammar - avatar