QuestenaPractice that shows what to review next
Question 94

Which exception type results from evaluating 7 % 0?

  1. ValueError
  2. ZeroDivisionErrorCorrect answer
  3. TypeError
  4. It returns 0

Explanation

Modulo by numeric zero has no defined finite result in Python, so the operation raises ZeroDivisionError. Returning zero would confuse a zero remainder with an invalid zero divisor.

Continue with this test

Start practice
Question 94: Which exception type results from evaluating 7 % 0? · Python Fundamentals · Questena