0

How to reverse string in python 3

1st Oct 2020, 5:01 PM
Riccardo Davinci
Riccardo Davinci - avatar
4 Respostas
1st Oct 2020, 5:06 PM
Abhay
Abhay - avatar
+ 1
Thank you
1st Oct 2020, 5:08 PM
Riccardo Davinci
Riccardo Davinci - avatar
+ 1
l = "hello" l2 = l[-1:] print(l2)
1st Oct 2020, 5:13 PM
HBhZ_C
HBhZ_C - avatar
0
Using slice starting from index -1 .You can store it in new variable and return this new variable if you want to use a function
1st Oct 2020, 5:08 PM
HBhZ_C
HBhZ_C - avatar