ProgrammingModerateTCS NQT · Wipro pattern
What is printed?
What is printed?
print('a' < 'b' < 'c', 'b' > 'a' and 'b' > 'c')- A. True True
- B. True False
- C. False False
- D. False True
Correct answer: B. True False
Chained string comparisons hold for a < b < c. The and needs b > c, which is False.
More Python Programming questions
- What is printed? python print(len([range(3), 'ab']), ['ab', [1]], {{'a': 1}, 'a': 2})
- What is printed? python print(hash(()) == hash(()), (1, 2) < (1, 2, 0), 'b' 2 > 'ab' 2, (1, 'b') < (1, 'a'))
- What is printed? python print(sorted(['b', 'B', 'a'], key=lambda s: (s.lower(), s)))
- What is printed? python from math import prod print(prod([2, 3, 4]), prod([]), prod([0.5, 4]), prod(range(1, 4), start=10))
- What is printed? python print(2 -1 2 1, 2 -(1 2) 1, (2 -1) (2 1))
- What is printed? python print('%-5s|%5s|' % ('ab', 'cd'), '%(x)d-%(y)s' % {'x': 1, 'y': 'z'})