Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c6abed4

Browse files
authored
Create test_key_in_dictionary
1 parent 00f9482 commit c6abed4

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

test_key_in_dictionary

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/python
2+
3+
4+
bdayHash={'raf':"08/01/98", 'Jen':"08/03/76"}
5+
6+
print "I know the birth days of:"
7+
for k in bdayHash.keys():
8+
print k
9+
10+
request = raw_input(">>> Who's birthday do you want to look up? ")
11+
12+
13+
while True:
14+
15+
if request not in bdayHash:
16+
print "{} is not in the list. enter new value ".format(request)
17+
request = raw_input(">>> Who's birthday do you want to look up? ")
18+
19+
else:
20+
print "{} was born in {}".format(request,bdayHash[request])
21+
break
22+
23+
24+
25+
26+
27+

0 commit comments

Comments
 (0)