Errors and input validation
Predict what parse_seats returns for each string.
Examples
Example 1
Input
"2.5"
Expected output
Enter a whole number
Example 2
Input
"0"
Expected output
Enter at least one seat
Example 3
Input
"8"
Expected output
8
Hints and solution
Hint 1
A string containing a decimal point cannot be passed to int directly.
Reveal worked answer
The decimal string hits the exception handler. Zero converts successfully and fails the range check. The string "8" converts and returns the integer 8.