0

How to reverse a line of string in Python.Example Input I am abhishek kumar output should be kumar ahishek am i

20th Sep 2021, 2:08 PM
Abhishek Kumar
Abhishek Kumar - avatar
3 odpowiedzi
+ 3
U can use [::-1] to reverse For example sen = "I am HrCoder"[::-1] print(sen)
20th Sep 2021, 2:13 PM
Pariket Thakur
Pariket Thakur - avatar
+ 3
Hint: 1. Split the string into an iterable using str.split() method 2. Reverse the iterable items order using slicing operator [ : : -1 ] 3. Join the iterable items using str.join() method.
20th Sep 2021, 2:27 PM
Ipang
+ 2
You can do slicing as mentioned by HrCoder or use reverse function
20th Sep 2021, 2:17 PM
Atul [Inactive]