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])- A. 25 987 Za
- B. 26 987 Za
- C. 25 789 Za
- 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
- What is printed? python print(int('1' 30) % 97, pow(10, 30, 97), (1030 - 1) // 9 % 97)
- What is printed? python print(sum(int(c) for c in str(21000)), len(str(21000)))
- What is printed? python print(len(set(str(i i) for i in range(10))), sorted([(-1) i i for i in range(6)]))
- What is printed? python print(list(map(round, [0.5, 1.5, 2.5, -0.5, -1.5])), list(map(int, [0.5, 1.5, 2.5, -0.5, -1.5])))
- What is printed? python print(max(['10', '9']), max(['10', '9'], key=len), sorted(['10', '9', '100'], key=lambda s: (len(s), s)))
- What is printed? python print(int(True) - ~True, 4 >> True, True << 3, True + True True)