-
Notifications
You must be signed in to change notification settings - Fork 0
/
drink.py
69 lines (52 loc) · 1.08 KB
/
drink.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
import sys
global money
global q
global button
menu={
1:["a",10, 100],
2:["b",10, 200],
3:["c",10, 300],
4:["d",10, 400],
5:["e",10, 500],
6:["f", 10, 600],
7:["g",10, 700],
8:["h",10, 800],
9:["i",10, 900]
}
def select():
global button
global money
print "==================================================="
for k, v in menu.items():
print "button:%d : name-%s amount-%d won-%d " % (k,v[0], v[1], v[2])
print "==================================================="
print ""
button=input( 'selct the button:')
if money-menu[button][2]>=0 and menu[button][1]>0:
print "%s come out" %menu[button][0]
menu[button][1]-=1
money-=menu[button][2]
print "You have %dwon" % money
select()
if money-menu[button][2]<0:
print " Lack of money to buy this tiem"
print "You have %dwon" % money
wait()
if menu[button][1]==0:
print "Empty of item"
select()
def wait():
global button
global money
global q
q=-1
a=input('Insert your money:')
money+=a
print "You have %dwon" % money
if a==-1:
sys.out()
if money>=0:
select()
money=0
q=-1
wait()