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

Added 4 May 2024

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

  1. "Python"
  2. "nohtyP" Correct answer
  3. "nohtyP"
  4. "ythoPn"

Correct answer

B. "nohtyP"

17 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