Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The csv file is pasted below the instructions! Help!Prompt user to give you name of the csv file. Csv file comes in this format, id

The csv file is pasted below the instructions! Help!Prompt user to give you name of the csv file. Csv file comes in this format, id, first_name, last_name, age, city, phone_number
You can always assume, csv file will have data and it will be in the same format shown above.
For testing purposes you can use this file: data.csv
Download data.csv
If file was found, proceed to show these filtering options.
1. filter by age
a. user must enter min and max age, show all rows that have age between min and max including the min and max number.
b. if user entered the same number for min and max, that means user is looking for a row specifically for that age
c. you must do checking where min shouldn't be greater than max. And min cannot be less than 0.
2. filter by city
a. once user enters city, present with all data that matches the city name, if none exist, just show a message saying no data found.
3. filter by last name
a. once user enters last name, present with all data that matches the last name, if none exist, just show a message saying no data found.
4. filter by first name
a. once user enters first name, present with all data that matches the first name, if none exist, just show a message saying no data found.
5. filter by id
a. same rules like age but with id instead.
Q to quit.
If data was filtered, give user an option to save filtered data.
Ex:
Please enter csv file name (or Q to exit): test
File was not found.
Please enter csv file name (or Q to exit): data.csv
File found.
Here are your filtering options:
1- Filter by age (min and max)
2- Filter by city
3- Filter by last name
4- Filter by first name
5- Filter by id (min and max)
or enter Q to quit
1
Please give min age for filtering: 18
Please give max age for filtering: 17
Max cannot be less than min!
Please give max age for filtering: 21
Here is the filtered data based on age between 18 and 21 inclusively.
User ID: 0
Alex Anderson
Omaha, NE
21
402-123-4567
-----------------
User ID: 13
Seth Green
Denver, CO
19
402-233-3232
(If no data was found, print a message saying no data was found, then move on to asking about going back to the main menu)
Would you like to save the filtered data? Y/N
Y
What should the name of the new file be?
filtered_age
Your filtered data was saved in filtered_age.csv <-- this must output a file with filtered data above saved in the same format as the original data.
Would you like to go back to the main menu? Y/N
N
Terminating program. Good bye!
---------------------------------------
There is a lot of repetitive functionality in this assignment, I am expecting you to be very efficient with your solutions. Utilize for loop, while loop and functions to reuse your code.
Your submission MUST include this file:
main.py - must have main function in it.id first_name last_name age city phone_number
0 John Doe 25 New York 123-456-7890
1 Jane Smith 32 Los Angeles987-654-3210
2 Michael Johnson 45 Chicago 555-123-4567
3 Emily Brown 28 Houston 999-888-7777
4 William Jones 22 Miami 111-222-3333
5 Sophia Lee 38 San Francisco444-555-6666
6 Alexander Wilson 29 Seattle 777-888-9999
7 Olivia Miller 50 Boston 666-555-4444
8 Daniel Moore 31 Atlanta 222-333-4444
9 Isabella Anderson 27 Dallas 888-777-6666
10 Ethan Thomas 35 Denver 444-333-2222
11 Mia Jackson 24 Phoenix 777-666-5555
12 James White 42 Austin 555-666-7777
13 Ava Harris 20 San Diego 666-777-8888
14 Benjamin Martin 26 Portland 999-888-7777
15 Sofia Thompson 48 Philadelphia333-222-1111
16 Elijah Garcia 23 Detroit 222-333-4444
17 Chloe Martinez 33 Minneapolis555-666-7777
18 Logan Robinson 36 Charlotte 111-555-3333
19 Amelia Clark 40 Orlando 888-444-5555
20 Lucas Rodriguez 21 Phoenix 666-555-4444
21 Luna Lopez 30 Miami 333-444-5555
22 Henry Hall 37 Chicago 222-555-6666
23 Harper Young 34 Atlanta 444-555-6666
24 William King 39 Seattle 555-444-5555

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

Databases Illuminated

Authors: Catherine M. Ricardo

1st Edition

0763733148, 978-0763733148

More Books

Students also viewed these Databases questions

Question

How many Tables Will Base HCMSs typically have? Why?

Answered: 1 week ago

Question

What is the process of normalization?

Answered: 1 week ago