-
Notifications
You must be signed in to change notification settings - Fork 8
/
09_kalkulator.py
60 lines (40 loc) · 1.02 KB
/
09_kalkulator.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
# kalkulator z menu
def suma(a, b):
return a + b
def roznica(a, b):
return a - b
def iloczyn(a, b):
return a * b
def iloraz(a, b):
return a / b
def potega(a, b):
return a ** b
def menu():
print("1. Dodawanie")
print("2. Odejmowanie")
print("3. Mnozenie")
print("4. Dzielenie")
print("5. Potegowanie")
print("6. Wyjscie")
def main():
while True:
menu()
wybor = input("Wybierz opcje: ")
if wybor == "6":
break
a = int(input("Podaj liczbe a: "))
b = int(input("Podaj liczbe b: "))
if wybor == "1":
print(suma(a, b))
elif wybor == "2":
print(roznica(a, b))
elif wybor == "3":
print(iloczyn(a, b))
elif wybor == "4":
print(iloraz(a, b))
elif wybor == "5":
print(potega(a, b))
else:
print("Niepoprawny wybor")
if __name__ == "__main__":
main()