The program illustrates the use of catching exceptions.
Exceptions are program statements that are used to control program errors, and prevent a program from crashing.
The statements that catch the exception in the program are:
try:
age = int(parts[1]) + 1
print('{} {}'.format(name, age))
# Get next line
parts = input().split()
name = parts[0]
except ValueError:
print('Invalid value!')
# Get next line
parts = input().split()
name = parts[0]
The complete program is as follows:
# Split input into 2 parts: name and age
parts = input().split()
name = parts[0]
while name != '-1':
# FIXME: The following line will throw ValueError exception.
# Insert try/except blocks to catch the exception.
try:
age = int(parts[1]) + 1
print('{} {}'.format(name, age))
# Get next line
parts = input().split()
name = parts[0]
except ValueError:
print('Invalid value!')
# Get next line
parts = input().split()
name = parts[0]
Read more about program exceptions at:
https://brainly.com/question/25012091