Created
August 1, 2022 07:23
-
-
Save humayanalrosid/80e0c8137bc585400dfc819cacc3f891 to your computer and use it in GitHub Desktop.
Honest Calculator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def check(text): | |
print(text) | |
calc = input() | |
x, oper, y = calc.split() | |
try: | |
float(x) + float(y) | |
if oper not in ["+", "-", "*", "/"]: | |
print("Yes ... an interesting math operation. You've slept through all classes, haven't you?") | |
check(text) | |
except ValueError: | |
print('Do you even know what numbers are? Stay focused!') | |
check(text) | |
check("Enter an equation") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment