ProgrammingHardTCS CodeVita · Infosys HackWithInfy
What is printed?
What is printed?
print(float('1e400'), -float('1e400'))- A. 1e400 -1e400
- B. OverflowError
- C. nan -nan
- D. inf -inf
Correct answer: D. inf -inf
Parsing a float string that is too large gives infinity rather than an error. Its negative is -infinity.
More Python Programming questions
- What is printed? python print(str(1e16), str(1e15), str(123456789.0))
- What is printed? python print(0.1 3, 1.1 1.1)
- What is printed? python print(5 / 2, 5 // 2, -5 / 2, -5 // 2)
- What is printed? python s = 'abc' print(s 0 == '', s[5:] == '', s[-1] + s[0])
- What is printed? python print(divmod(-9, 2), divmod(9, -2))
- What is printed? python x = [1, 2] x += x x = 2 print(x)