This repository was archived by the owner on Jul 3, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcalc.py
More file actions
69 lines (57 loc) · 1.32 KB
/
calc.py
File metadata and controls
69 lines (57 loc) · 1.32 KB
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
from click._compat import raw_input
import tkinter
def print_menu():
print("Vyberte si jednu moznost")
print("***********")
print("(S) sucet")
print("(O) odcitanie")
print("(N) nasobenie")
print("(D) delenie")
print("(x) koniec")
print("***********")
def get_option():
return raw_input()
def print_cisla():
print("Zadaj dva cisla")
def scitanie():
print_cisla()
a = float(raw_input())
b = float(raw_input())
return a + b
def odcitanie():
print_cisla()
a = float(raw_input())
b = float(raw_input())
return a - b
def nasobenie():
print_cisla()
a = float(raw_input())
b = float(raw_input())
return a * b
def delenie():
print_cisla()
a = float(raw_input())
b = float(raw_input())
return a / b
def decide(char):
res = -1
if(char=='S' or char == 's'):
res = scitanie()
elif(char=='O' or char == 'o'):
res = odcitanie()
elif(char=='N' or char == 'n'):
res = nasobenie()
elif(char=='D' or char == 'd'):
res = delenie()
elif(char=='X' or char == 'x'):
exit(1)
else:
print("Nespravne zadane pismeno")
return
print("Vysledok je: ", res)
def main():
while(1):
print_menu()
decide(get_option())
if __name__ == '__main__':
main()