1 # 9. Take a prefix as input and print the number of boys and girls with that
2 # prefix. (i.e., "m" would list babies whose names start with "m" and "ma"
3 # would list babies whose names start with "ma", etc).
7 prefix = input("Input a prefix: ")
9 boysNamesWithPrefix = 0
10 for boysName in ssadata.boys.keys():
11 if boysName.startswith(prefix):
12 boysNamesWithPrefix = boysNamesWithPrefix + 1
14 print("There are " + str(boysNamesWithPrefix) + " boys names that start with " + prefix + ".")
16 girlsNamesWithPrefix = 0
17 for girlsName in ssadata.girls.keys():
18 if girlsName.startswith(prefix):
19 girlsNamesWithPrefix = girlsNamesWithPrefix + 1
21 print("There are " + str(girlsNamesWithPrefix) + " girls names that start with " + prefix + ".")