ProgrammingModerateTCS NQT · Infosys

What is printed?

What is printed?
import string
print(string.ascii_lowercase.index('z'), string.digits[::-1][:3], string.ascii_uppercase[25] + string.ascii_lowercase[0])
  1. A. 25 987 Za
  2. B. 26 987 Za
  3. C. 25 789 Za
  4. D. 25 987 Az

Correct answer: A. 25 987 Za

'z' is at index 25 of the lowercase alphabet. Reversing the digit string gives 9876543210, and its first three characters are 987.

More Python Programming questions

Exams that ask this topic