Question
PYTHON Exercise 1 (100 pts) For this assignment, you will work with the data files provided in the names folder in the files section of
PYTHON
Exercise 1 (100 pts)
For this assignment, you will work with the data files provided in the "names" folder in the files section of this class. These files contain national data on the relative frequency of given names in the population of U.S. births where the individual has a Social Security Number. For each year of birth YYYY after 1879, there is a comma-delimited file called yobYYYY.txt. Each record in the individual annual files has the format "name,sex,number," where "name" is 2 to 15 characters, "sex" is M (male) or F (female) and "number" is the number of occurrences of the name. Each file is sorted first on sex and then on number of occurrences in descending order.
Write a Python program that iterates through all the data files in the folder and calculates the total number of occurrences of a given name. Your program should do the following:
Ask the user for a name they're interested in
Go through all the data files and find every instance of that name, adding them up to a total
Display the total number of instances of the given name.
For example, for the name "Alejandro" your program should perform as follows
What name are you interested in? Alejandro Alejandro has been used a total of 132243 times
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started