ProgrammingVery hardJEE Main · CAT placement
What is printed?
What is printed?
print(float('1e400'), -float('1e400'), float('1e308') * 10)- A. 1e400 -1e400 inf
- B. inf -inf 1e309
- C. inf -inf inf
- D. Infinity -Infinity inf
Correct answer: C. inf -inf inf
Parsing a number too large for a float gives inf rather than an error, and so does float multiplication that overflows. Python prints the float infinity as inf, with a minus sign for the negative one.
More Python Programming questions
- What is printed? python print(int(1e23))
- What is printed? python print('x' 0 == '', 'Z' < 'a', '10' < '9', 'apple' < 'Apple')
- What is printed? python print(len('eu0301'), 'é' == 'eu0301')
- What is printed? python print(0b1010 & ~0b10, 0b1010 ^ 0b1111, 1 << 3 | 1, 6 & 3 == 2)
- What is printed? python print(1 << 100 >> 99) try: print(1 >> -1) except ValueError as e: print(e)
- What is printed? python print(len(str(21000)), sum(map(int, str(21000))))