Skip to content

Instantly share code, notes, and snippets.

@spheppner
Last active October 5, 2017 14:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spheppner/240ff10ea5b24a037f19b92227175126 to your computer and use it in GitHub Desktop.
Save spheppner/240ff10ea5b24a037f19b92227175126 to your computer and use it in GitHub Desktop.
Open-Source Taschenrechner für alle Betriebsysteme (Python)
import os
while True:
a = input("Enter the first number and press RETURN >> ")
try:
num1 = int(a)
except:
continue
break
while True:
print("\n"*100)
b = input("Choose one of those operators and press RETURN '+ / * -' ")
if b in "+/*-":
break
while True:
print("\n"*100)
c = input("Enter the second number and press RETURN >> ")
try:
num2 = int(c)
except:
continue
break
if b == "-":
print(num1-num2)
if b == "+":
print(num1+num2)
if b == "/":
if num2 == 0:
print("DIVISION BY ZERO! Not possible.")
else:
print(num1/num2)
if b == "*":
print(num1*num2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment