Skip to content

Commit 8b9893c

Browse files
committed
code for chapter 5
1 parent 3d9a700 commit 8b9893c

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
book = dict()
2+
# an apple costs 67 cents
3+
book["apple"] = 0.67
4+
# milk costs $1.49
5+
book["milk"] = 1.49
6+
book["avocado"] = 1.49
7+
print book
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
voted = {}
2+
def check_voter(name):
3+
if voted.get(name):
4+
print "kick them out!"
5+
else:
6+
voted[name] = True
7+
print "let them vote!"
8+
9+
check_voter("tom")
10+
check_voter("mike")
11+
check_voter("mike")

0 commit comments

Comments
 (0)