+ 1
How to invert a string in python
Ex: Air Ria
7 Respostas
+ 1
To replace a string, use the following code:
1) string="hi world"
2) new_string=string.replace ("hi","hello")
3) print (new_string)
***output***:
hello world
+ 6
Arydev , if your string is for example s = "Air", you can use s[:: - 1] to slice it backwards 🐱
+ 3
Arydev , please look at the code. Hope now everything is clear 🐱
https://code.sololearn.com/c7aoNwSsP98C/?ref=app
+ 1
How to replace a string
0
Is clear i understand it
0
Reverse sentence by words
https://code.sololearn.com/c975HM34JFS4/?ref=app
0
name = 'Air'
# Change Air to Ria
name_change = name[::-1].lower() #Change the str to lower
user_output = name_change.capitalize() #Capitalize
print(user_output)