Question: The while loop reads values from input until an integer is read. Add an except block in the while loop to handle an exception and
The while loop reads values from input until an integer is read. Add an except block in the while loop to handle an exception and output 'Bad input for month of birth is discarded'.
found_one = False while not found_one: try: month_of_birth = int(input()) found_one = True print(f'Month of birth: {month_of_birth}') print('Processed one valid input value')
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
