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