+ 4

How to reverse a string in python??

input: name output: eman

25th Aug 2018, 5:04 AM
Pratik Patil
Pratik Patil - avatar
9 Respostas
+ 5
string_name [::-1]
25th Aug 2018, 4:56 PM
Mitali
Mitali - avatar
+ 4
I believe this is the code you are looking for: https://code.sololearn.com/cr2ZNyhEWdlV/?ref=app
25th Aug 2018, 8:28 AM
Ian Ault
Ian Ault - avatar
+ 2
I made a little program for reversing: a = input("") b = "" c = len(a)-1 i = 0 while(i<=c): b = b + a[c-i] i = i+1 print (b) https://code.sololearn.com/c36AYfYjHmx0/?ref=app
25th Aug 2018, 11:43 PM
Timur Sarantsev
+ 1
is there any other way? like by making a list
25th Aug 2018, 6:19 AM
Pratik Patil
Pratik Patil - avatar
+ 1
def spell(txt): #your code goes here rev = ''.join(reversed(txt)) print(rev) txt = input() spell(txt)
7th Feb 2021, 11:06 PM
AL-Mahdi Ait-ounzar
AL-Mahdi Ait-ounzar - avatar
0
how can we compiler java frd
25th Aug 2018, 5:30 PM
Aliyu
0
Hi Mitali... I need some help..
29th Aug 2018, 12:32 AM
Hari Krishna
Hari Krishna - avatar
0
name_string = "hello world" print(name_string[::-1]) output dlrow olleh
11th Feb 2022, 12:56 PM
Swethaa K
Swethaa K - avatar