ProgrammingHardTCS NQT · Wipro pattern
What is printed?
What is printed?
print('a' < 'B', 'a'.upper() < 'B')- A. True True
- B. False False
- C. False True
- D. True False
Correct answer: C. False True
Comparison uses code points, so 'a' (97) is greater than 'B' (66). Uppercasing a gives 'A' (65), which is less than 'B'.
More Python Programming questions
- What is printed? python print(0 == False, 0 is False, '' == None)
- What is printed? python print(any(x > 2 for x in [1, 2, 3]), next(x for x in [1, 2, 3] if x > 1))
- What is printed? python print(list(range(5, 0, -2)), list(range(0)), range(3)[1:])
- What is printed? python print('x'.join('abc'), 'abc'.join('x'))
- What is printed? python print(True + True, 3 True, 'ab' True)
- What is printed? python print('%.3e' % 12345.678)