Preserve the rejection rule

A workshop permits integer group sizes from 1 through 16. Its Python validator is:


Python
def validate_group(quantity):
    if quantity < 1:
        raise ValueError("quantity must be positive")
    if quantity > 16:
        raise ValueError("quantity exceeds the limit")
    return quantity


Select every change that preserves exactly which integer inputs cause an exception to be raised. Compare exception occurrence only; the exception messages need not match.

Choose an answer

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Raising Exceptions Questions: