+ 6
How to reverse alphabets of a string in Python?
18 ответов
+ 7
Thank you guys
Sinjini Dutta
Narayana Prasad
AKR
Abgar Abrahamyan
Gabriel
karim Abdel ouadeh
+ 6
Use this 👇👇
https://code.sololearn.com/c0vbdQUJN7rS/?ref=app
+ 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
+ 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
+ 4
s=input("Enter a string:")
print(s[::-1])
Just use slicing.
+ 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.😊
+ 2
Same for me
+ 2
You may find answer in https://www.journaldev.com/23647/JUMP_LINK__&&__python__&&__JUMP_LINK-reverse-string
+ 2
Print("string"[:-1])
+ 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])
+ 1
Reverse string
https://code.sololearn.com/cEs8v57Wg8GN/?ref=app
+ 1
variablename='python'
print(variablename[-1::-1])
output- nohtyp
+ 1
your_variable.reverse()
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)
- 4
hi