/
Taschenrechner.py
78 lines (62 loc) · 1.66 KB
/
Taschenrechner.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import sys
A: int
B: int
def adition(wert1 , wert2):
ergebnis = wert1+wert2
return ergebnis
def subtraktion(wert1,wert2):
ergebnis = wert1-wert2
return ergebnis
def multiplikation(wert1, wert2):
ergebnis = wert1*wert2
return ergebnis
def division(wert1, wert2):
ergebnis = wert1/wert2
return ergebnis
def eingabe():
global A, B
while True:
try:
A = int(input("1. Zahl : "))
B = int(input("2. Zahl : "))
except ValueError:
print("Fehler: Zahl muss eine Ganzzahl sein!!")
else:
break
print("Taschenrechner 02.04.2020 By Roli\n")
while True:
print(
"1. Addition",
"2. Subtraktion",
"3. Multiplikation",
"4. Division",
"5. EXIT",
"",
sep="\n"
)
choise = int(input("Ihre Wahl? "))
if choise == 1:
print("ADDITION")
eingabe()
print("\nDie Summe von ",a," und ",b," = ",adition(a,b))
print()
elif choise == 2:
print("SUBTRAKTION")
eingabe()
print("\nDie Differenz von ",a," und ",b," = ",subtraktion(a,b))
print()
elif choise == 3:
print("MULTIPLIKATION")
eingabe()
print("\nDas Produkt von ",a," und ",b," = ",multiplikation(a,b))
print()
elif choise == 4:
print("DIVISION")
eingabe()
print("\nDer Quotient von ",a," und ",b," = ",division(a,b))
print()
elif choise ==5:
print("\nAUF WIEDERSEHEN")
sys.exit()
else:
print("Bitte nur Zahlen zwischen {} und {} eingeben!".format(1,5))