]> projects.mako.cc - babynames_answers/blob - answer_7.py
2ce820bf4656c949457927ed17f222192d54e4e7
[babynames_answers] / answer_7.py
1 # 7. Write a program that will take a name as input and return the number of
2 #    girls and boys with that name.
3
4 import ssadata
5
6 name = input("Input a name: ")
7
8 if name in ssadata.boys.keys():
9     print("There are " + str(ssadata.boys[name]) + " boys named " + name)
10 else:
11     print("There are 0 boys named " + name)
12
13 if name in ssadata.girls.keys():
14     print("There are " + str(ssadata.girls[name]) + " girls named " + name)
15 else:
16     print("There are 0 girls named " + name)
17

Benjamin Mako Hill || Want to submit a patch?