Programming Exercise 16 |
< Previous Next > |
Write a program that reads a file with baby names in it.
Store the contents of the file into two separate lists of tuples (one list for each gender).
Ask the user which list (or both) that they want to search, then for a name.
Report how many babies share that name for the specified list(s).
Use the following input file: babyNamesAndCounts.csv.
The input file has the following columns:
Please enter 'female', 'male', or 'both' to search respective list(s): both Please enter a name to search for: Alexander Alexander was not a popular female baby name in 2015. Alexander was a popular male baby name in 2015 with 14,460 babies.
Please enter 'female', 'male', or 'both' to search respective list(s): male Please enter a name to search for: Christopher Christopher was a popular male baby name in 2015 with 9,742 babies.
Please enter 'female', 'male', or 'both' to search respective list(s): both Please enter a name to search for: Riley Riley was a popular female baby name in 2015 with 5,707 babies. Riley was a popular male baby name in 2015 with 2,069 babies.
handin pe16 pe16.pyTo verify your submission, type the following in a terminal window:
handin pe16