What is the output of print(list("123"[::-1])) in Python?

  • ['1', '2', '3']
  • ['3', '2', '1']
  • [1, 2, 3]
  • [3, 2, 1]
The output will be a list containing the characters of the string "123" in reverse order. The [::-1] slicing reverses the string, and list() converts it into a list of characters.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *