29th Mar 2020, 4:52 AM
Payal Sharma
Payal Sharma - avatar
18 Réponses
+ 7
Thank you guys Sinjini Dutta Narayana Prasad AKR Abgar Abrahamyan Gabriel karim Abdel ouadeh
30th Mar 2020, 7:14 AM
Payal Sharma
Payal Sharma - avatar
3rd Jun 2020, 1:24 AM
Tanmay Gupta
Tanmay Gupta - avatar
+ 4
Yss.. I did it! Thnx for idea. Here is code... word = input() i = len(word)- 1 while i >= 0 : print(word[i]) i -= 1
29th Mar 2020, 5:59 AM
Ravi Mishra
Ravi Mishra - avatar
+ 4
#This is a standard package where you can define alphabets like lowercase and uppercase #Here the code goes from string import ascii_lowercase print(ascii_lowercase[::-1]) #Try using ascii_uppercase and ascii_letters
29th Mar 2020, 8:34 AM
Mir-Abgar Abrahamyan
Mir-Abgar Abrahamyan - avatar
+ 4
s=input("Enter a string:") print(s[::-1]) Just use slicing.
30th Mar 2020, 7:11 AM
Sinjini Dutta
Sinjini Dutta - avatar
+ 3
I have a shortcut for you or may be u already know. Use list slicing!😏 E.g. Text = input() Print(text[::-1]) Note :- Remember.. string is list of characters.😊
13th Apr 2020, 8:55 PM
Ravi Mishra
Ravi Mishra - avatar
+ 2
Same for me
29th Mar 2020, 5:28 AM
karim abdel ouadeh
29th Mar 2020, 4:10 PM
narayanaprasad
narayanaprasad - avatar
+ 2
Print("string"[:-1])
31st Mar 2020, 1:49 AM
Ankit Singh
Ankit Singh - avatar
+ 2
For simplicity, assign your string to a variable and do an index slicing on it from the beginning to the end of the string with a step slice of negative one (-1) . EXAMPLE: my_var = "abcdefgh" print(my_var[::-1])
31st Mar 2020, 8:43 AM
GBADEGESIN OLUWASEGUN MICHAEL
GBADEGESIN OLUWASEGUN MICHAEL - avatar
30th Mar 2020, 3:36 PM
Abhishek Kumar
Abhishek Kumar - avatar
+ 1
variablename='python' print(variablename[-1::-1]) output- nohtyp
30th Mar 2020, 6:53 PM
Rishi
Rishi - avatar
+ 1
your_variable.reverse()
31st Mar 2020, 1:36 AM
xLord
xLord - avatar
0
def reverse_words_ and _swap_cases (sentence): input (sentence)==0 return (sentence) else: return reverse_words_order( sentence[1:] + sentence[0]: print (sentence) reverse_string( sentence) Print( sentence)
22nd Aug 2020, 11:03 PM
phalguni bagde
phalguni bagde - avatar
- 4
hi
29th Mar 2020, 8:53 AM
Ivan