-3

i want to reverse the order of characters in a string so take strings as arguments and return s new string with letters of the original string example - "hello" would return "olleh"

All I have gotten to is:

def reverse(" "):
   string = input("Give me a word")
   x = ord(string)
   print(x)
Lucy
  • 5
  • 1
  • 2

1 Answers1

2

You can do it like this:

"hello"[::-1]

You can read about extended-slices here

idjaw
  • 25,487
  • 7
  • 64
  • 83