+ 4

Please how do i reverse this word"howdy" to "ydwoh" using python

3rd Aug 2020, 10:59 PM
Lotus Robe
6 Réponses
+ 3
Especially for python there is a very quick and simple way, but for you as beginner it's quite sure better to do this task with a loop. If you share your code here via link to playground, we'll help you to solve it.
3rd Aug 2020, 11:03 PM
Sandra Meyer
Sandra Meyer - avatar
+ 2
There are many ways for string reversing in python. Method 1: s = 'howdy' print(s[::-1]) Method 2: s = 'howdy' rev = '' for i in range(len(s)-1,-1,-1): rev += s[i] print(rev) #method 2 is used in most programming languages. Method 3: s = 'howdy' l = list(s) l.reverse() print(''.join(l))
5th Aug 2020, 5:22 AM
MSN
MSN - avatar
+ 1
try doing it manually with a for loop to understand how it works. but if you just want a quick method to do it here is the solution. text = "howdy" print(text[::-1])
4th Aug 2020, 1:57 AM
Shen Bapiro
Shen Bapiro - avatar