Question: [PYTHON] Part 1: Read name_age.csv file. This file contains the first name, family name, and age of the person. Open the file by my_file =

[PYTHON]

Part 1: Read name_age.csv file. This file contains the first name, family name, and age of the person.

Open the file by

my_file = open(name_age.csv)

There is no header line in this file. We need to read the file line by line and print it to see the content. We see that each line is a string. "Aaron, Hank", 23

We should split each line and place it inside a list. There may be extra characters such as quotation marks.

Extra quotation marks can be removed by

without_quot = with_quot.replace(, ) # replaces double quotes with a space.

Also, the first name and last name of each person are two strings. We can join them to have one string. Eventually, we want to have a list with two items: [familyname name, age] for each line.

Part 2: Print the names of the oldest and the youngest persons.

Part 3: Create the name_dictionary, which has names as keys and age as the value. Allow the user to give an age number, and the program prints the names that are that age. For example, if the user enters 24, the program prints five names.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!