Last active
October 5, 2017 14:39
-
-
Save spheppner/240ff10ea5b24a037f19b92227175126 to your computer and use it in GitHub Desktop.
Open-Source Taschenrechner für alle Betriebsysteme (Python)
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
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