ProgrammingHardGATE CS & IT · Infosys
What is printed?
What is printed?
print(float('inf') > 10**308, -float('inf') < -10**308)- A. False True
- B. True False
- C. False False
- D. True True
Correct answer: D. True True
Infinity compares greater than any finite int, even huge ones, and negative infinity compares smaller. Python handles this comparison exactly.
More Python Programming questions
- What is printed? python print(sorted({3: 'a', 1: 'b'}), list(reversed(sorted({3: 'a', 1: 'b'}))))
- What is printed? python print('a' < 'B', 'a'.upper() < 'B')
- 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'))