+ 1

Please how do I write a code to reverse a word in python

I want the word to be spelt backwards

26th Sep 2021, 1:08 PM
bernard
bernard - avatar
2 Answers
+ 8
bernard Try this word = 'abcd' print(word[::-1])
26th Sep 2021, 1:09 PM
AÍąJ
AÍąJ - avatar
+ 1
using list slicing which is the shortest method word = "I am the best" print(word[::-1])
27th Sep 2021, 9:08 AM
iTech
iTech - avatar