Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

[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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Understanding Oracle APEX 5 Application Development

Authors: Edward Sciore

2nd Edition

1484209893, 9781484209899

More Books

Students also viewed these Databases questions

Question

Write or share answers to the following questions:

Answered: 1 week ago