ProgrammingVery hardTCS CodeVita · Infosys HackWithInfy
What is printed?
What is printed?
try:
print(1.0 // 0.0)
except ZeroDivisionError as e:
print(e)- A. inf
- B. ZeroDivisionError
- C. float floor division by zero
- D. division by zero
Correct answer: C. float floor division by zero
Floor division by a float zero raises ZeroDivisionError with the message 'float floor division by zero'. Unlike plain float division, it does not return inf.
More Python Programming questions
- What is printed? python print(int('0x1A', 16), int('1A', 16), int('0x1A', 0))
- What is printed? python print(len(str(10 400 // 3)))
- What is printed? python print(1000000 == 10 6, 0x1F, 1e3 == 1000)
- What is printed? python print(oct(64), hex(-255), bin(0))
- What is printed? python print(ord('A') ^ 32, chr(ord('a') - 32))
- What is printed? python t = ([],) t[0].append(1) print(t, t[0] is t[0])