Skip to content

Instantly share code, notes, and snippets.

@humayanalrosid
Created August 1, 2022 07:23
Show Gist options
  • Save humayanalrosid/80e0c8137bc585400dfc819cacc3f891 to your computer and use it in GitHub Desktop.
Save humayanalrosid/80e0c8137bc585400dfc819cacc3f891 to your computer and use it in GitHub Desktop.
Honest Calculator
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