CBSE Class 12 Computer Science Question 26 of 43

Practice Paper — Question 8

Back to all questions
8
Question

Question 23(a)

Given is a Python string declaration:

voice = "Python for All Learners"

Write the output of:

print(voice[20 : : -2])
Answer
Output
ere l o otP
Explanation

voice[20 : : -2]: Starting from index 20, the expression goes till the end of the string in reverse order with a step size of -2.