How to flip an input backwards with phyton | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to flip an input backwards with phyton

Sample input:howdy Sample output:ydwoh

18th May 2021, 8:33 PM
$BANANA$
5 Answers
+ 4
You can loop over the length of it and start with character printing from last index to first index . or you can use slicing to reverse it , i.e. string[::-1].
18th May 2021, 8:58 PM
Abhay
Abhay - avatar
+ 2
You can simply use slicing for it: "howdy"[::-1] ---> "ydwoh"
18th May 2021, 8:57 PM
Seb TheS
Seb TheS - avatar
18th May 2021, 8:58 PM
Seb TheS
Seb TheS - avatar
19th May 2021, 4:30 AM
NEZ
NEZ - avatar
0
Thanks Abhay...can u tell me where u learn from cos I didnt see this in my module...Buh anyway I haven't gone far😅
19th May 2021, 12:59 AM
$BANANA$