]> projects.mako.cc - babynames_answers/blob - answer_1.py
a2185bbade7d2a62bf235fc6ddee8ec3bdc37122
[babynames_answers] / answer_1.py
1 # 1. Search for your own name. Are there both boys and girls that have your
2 #    name? Is it more popular for one group than for the other?
3
4 import ssadata
5
6 name = "mako"
7
8 if name in ssadata.boys.keys():
9     boys_count = ssadata.boys[name]
10     print("there were " + str(boys_count) + " boys named " + name)
11 else:
12     boys_count = 0
13     print("there were no boys named " + name) 
14
15
16 if name in ssadata.girls.keys():
17     girls_count = ssadata.girls[name]
18     print("there were " + str(girls_count) + " girls named " + name)
19 else:
20     girls_count = 0
21     print("there were no girls named " + name)
22
23
24 if boys_count > girls_count:
25     print("there were more boys named " + name + " than girls")
26 elif boys_count == girls_count:
27     print("there were the same number boys and girls named " + name)
28 else:
29     print("there were more girls named " + name + " than boys")

Benjamin Mako Hill || Want to submit a patch?