feat(problem-04.py): an attempt at solving.
This commit is contained in:
@@ -3,14 +3,9 @@
|
||||
|
||||
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.")
|
||||
result = x * y
|
||||
except TypeError:
|
||||
# Print message stating one or both values entered are not numbers
|
||||
print(f"Either {x} and/or {y} is not a number.")
|
||||
print(f"Either {x} and/or {y} are not numbers.")
|
||||
|
||||
|
||||
# Call the numb_check function and prompt user for input
|
||||
numb_check(x = input("Enter a number: "), y = input("Enter another number: "))
|
||||
Reference in New Issue
Block a user