Respuesta :
Answer:
x = str("abc")
y = str("15")
z = str("boo")
try:
total = int(x) + int(y) + int(z)
print(total)
except ValueError:
print("bad value(s) in:",end=' ')
if not x.isdigit():
print(' x',end=' ')
if not y.isdigit():
print(' y',end=' ')
if not z.isdigit():
print(' z',)
Explanation:
- Inside the try-catch block for exception handling, add the x, y and z variable to calculate the total of these three.
- Use an if statement to check whether x is a digit or not and display the string "bad value(s) in:"
- Use an if statement to check whether the y is a digit or not and display the string "bad value(s) in:"
- Use an if statement to check whether the z is a digit or not and display the string "bad value(s) in:"