Question: PYTHON 3 Functions creating /updating ranked databases These functions start from a database that either has incomplete rankings, or with incorrect rankings. They will need
PYTHON 3
Functions creating/updating ranked databases
These functions start from a database that either has incomplete rankings, or with incorrect rankings. They will need to create correct rankings for the rsulting database.
rank_names_by_year_gender (db, year, gender) : This function accepts an existing (unranked)
database db, a year and a gender. It calculates the ranking of names according to their counts and updates that information into the database. Rank male and female names separately. The most popular name for each gender (with the highest count) gets a rank value of 1. Assign all tied-count names with the same rank and make sure the next rank is adjusted accordingly.
Given counts of A:10, B:5, C:5, D:5, E:1, they'd get rankings of A=1, B=2, C=2, D=2, E=5. This function updates the database in-place and returns None.
rank_names (db) : This function accepts an existing database and ranks all names for all years of data present, making the database become ranked. This function should return None. Rank male and female names separately.
Hint: use previous functions!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
