Question: Use python, no outside imports, no recursion. Use a SINGLE FUNCTION to solve (no main methods or anything outside function call). Skeleton file: def trip_planner(tuplist):

Use python, no outside imports, no recursion. Use a SINGLE FUNCTION to solve (no main methods or anything outside function call). Skeleton file:
def trip_planner(tuplist):
ANSWER HERE
 Use python, no outside imports, no recursion. Use a SINGLE FUNCTION
to solve (no main methods or anything outside function call). Skeleton file:

Eunction name trip_planner Parameters: list of tuples Returns, dictionary with each value as a dictionary Description: You and your friends are planning a trip to NYC! In preparation, you guys make a list together of things you want to do when you get to NYC, except it's a little bit disorganized with a lot of duplicate activities. Your job is to organize the list into a more accessible dictionary Each element in the input list is a tuple containing the category (string), name (string). and cost (int) of the activity. The output dictionary should arrange the activities first by using their category as keys. The assigned value of each category should be another dictionary that maps each corresponding activity name to its associated cost. If there are duplicate activities with the same category and name, their costs should all be added together >>list1 [Cshow, Shawn Mendes: the Concert, 100), (food, 'Levain Bakery, 10000) sightseeing. 'Statue of Liberty, 0), (show, "Hamilton', 20) (sightseeing', Brooklyn Bridge', 10), show, 'Hamilton', 70), Ctood, 'Halal Guys', 5), (show, Shawn Mendes: the Concert, 200)] >> print(trip_ planner(list1)) show: [Shawn Mendes the Concert: 300, Hamilton': 90), food: fLevain Bakery' 10000, Halal Guys': 5), 'sightseeing: [Statue of Liberty': 0, 'Brooklyn Bridge: 10))

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!