1. Home
  2. Data Science
  3. Python
  4. What is the output of "python"[::-1] in Python?

Added 4 May 2024

What is the output of "python"[::-1] in Python?

  1. "python"
  2. "nohtyp" Correct answer
  3. "nythop"
  4. Error

Correct answer

B. "nohtyp"

15 views

MCQSEXAM

Explanation

Slicing with [::-1] reverses the string, so "python"[::-1] results in "nohtyp".

Doubts & discussion

Not sure why the answer is B? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More Python MCQs

Practise all Python MCQs

Similar MCQs