ProgrammingHardTCS CodeVita · Infosys HackWithInfy
What is printed?
What is printed?
print(float('nan') < 0, float('inf') > 10 ** 300, -float('inf') < -10 ** 300)- A. False True True
- B. True True True
- C. False False True
- D. False True False
Correct answer: A. False True True
Any comparison with NaN is False. Infinity is larger than every finite int and -infinity is smaller than every finite int, so the last two are True.
More Python Programming questions
- What is printed? python print(10 309 > float('inf'), end=' ') try: float(10 309) except OverflowError as e: print(e)
- What is printed? python from collections import Counter d = {'a': 1, 'b': 2} v = d.values() d['c'] = 3 print(len(v), list(v))
- What is printed? python print(frozenset([1, 2]) == {1, 2}, {frozenset([1]): 'x'}[frozenset([1])])
- What is printed? python a = [1, 2, 3] r = a.reverse() print(r, a)
- What is printed? python t = (1) u = (1,) print(type(t).name, type(u).name, len(u))
- What is printed? python try: print(1.0 // 0.0) except ZeroDivisionError as e: print(e)