Files
cybr108/lab-02/problem-04.py
T
2026-09-12 21:01:33 -04:00

16 lines
647 B
Python

# Write a Python program that prompts the user to input two numbers and raises a TypeError exception if the inputs are
# not numerical.
def numb_check(x, y):
try:
# Try if both values entered are numbers
x == float(x)
y == float(y)
# Print a confirmation message
print(f"Correct. Both {x} and {y} are numbers.")
except TypeError:
# Print message stating one or both values entered are not numbers
print(f"Either {x} and/or {y} is not a number.")
# Call the numb_check function and prompt user for input
numb_check(x = input("Enter a number: "), y = input("Enter another number: "))