**PYTHON*** I need a program written that can do the following: use the list of tuples given as a starting point for data. option 1 should print the full list of tuples, and the printing needs to be formatted so that the data lines up neatly. option 2 needs to work so that a user can enter the name, destination, and mileage for a new trip, and have that data be added as a tuple to the list. options 3 need to allow filtering the list by name option 4 just needs to allow the program to end if the user does not enter 1, 2, 3 or 4 as an option, you need to print an error message and have them re-enter their choice. there needs to be a main function that kicks things off, and you need to write a function to print the whole list, a function that allows inputting a new trip, and a function that filters by name and prints all the trips for that given name. These functions are called when the user types in a given option from the menu. if you add a new trip, everything should still work The menu options must be: Program Options. Display all trips Input new trip Display trips by Name Exit Each of the first 3 options should call a function to accomplish the proper task. Tuples: trips = [ (“alice”, ‘chicago’, 302), (“bruce”, ‘chicago’, 309), (“david”, ‘chicago’, 307), (“carol”, ‘columbus’, 212), (“alice”, ‘chicago’, 304), (“bruce”, ‘chicago’, 301), (“david”, ‘columbus’, 215), (“alice”, ‘chicago’, 302), (“carol”, ‘chicago’, 305), (“bruce”, ‘chicago’, 304), (“carol”, ‘columbus’, 218), (“alice”, ‘columbus’, 217), (“carol”, ‘chicago’, 309) (“david”, columbus, 219)
***PYTHON*** I need a
- use the list of tuples given as a starting point for data.
-
option 1 should print the full list of tuples, and the printing needs to be
formatted so that the data lines up neatly.
-
option 2 needs to work so that a user can enter the name, destination,
and mileage for a new trip, and have that data be added as a tuple to the
list.
-
options 3 need to allow filtering the list by name
- option 4 just needs to allow the program to end
-
if the user does not enter 1, 2, 3 or 4 as an option, you need to print an
error message and have them re-enter their choice.
-
there needs to be a main function that kicks things off, and you need to
write a function to print the whole list, a function that allows inputting a
new trip, and a function that filters by name and prints all the trips for
that given name. These functions are called when the user types in a
given option from the menu.
-
if you add a new trip, everything should still work
The menu options must be:
Program Options.
- Display all trips
- Input new trip
- Display trips by Name
- Exit
Each of the first 3 options should call a function to accomplish the proper task.
Tuples:
trips = [
(“alice”, ‘chicago’, 302),
(“bruce”, ‘chicago’, 309),
(“david”, ‘chicago’, 307),
(“carol”, ‘columbus’, 212),
(“alice”, ‘chicago’, 304),
(“bruce”, ‘chicago’, 301),
(“david”, ‘columbus’, 215),
(“alice”, ‘chicago’, 302),
(“carol”, ‘chicago’, 305),
(“bruce”, ‘chicago’, 304),
(“carol”, ‘columbus’, 218),
(“alice”, ‘columbus’, 217),
(“carol”, ‘chicago’, 309)
(“david”, columbus, 219)
Step by step
Solved in 4 steps with 5 images