Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Only question2 Question 2: Dictionary to a tuple of lists Write a function that takes in a dictionary (described in problem 1) and converts it

Only question2 image text in transcribed
image text in transcribed
Question 2: Dictionary to a tuple of lists Write a function that takes in a dictionary (described in problem 1) and converts it to a tuple of lists, where each list is the number and the corresponding age def from dict to_tuple (dict): " Converts dictionary in a list of lists > sorted (from_dict_to_tuple (people), key-1ambda tup: tup[1) ['Alexa', 3, ['Betty', 14, ['Mike, 17), ('Marina', 20, ['Robert, 23) ['Siri', 4511 >>> tutors 'name': ('Rajit', 'Joey, 'age : (21, 191) s sorted(from dict to tuple (tutors) , key-lambda tup: tup(1) II'Joey,19, ['Rajit', 21]] >from dict to tuple (empty dict) Your code is here Question 1: Modify the dictionary Write a function, add _new_ person, that takes a dictionary with two keys: "name" and "age" and a list that represent a person [name, age], then your function adds a new person to the dictionary. The dictionary must mutate (do not create another copy). def add new person (dict, 1st) """Adds new person to the dictionary >>> people ("name" "Marina", "Robert","Mke", "Siri", "Alexa", "Betty", "age": [20, 23, 17, 41, 3, 14]) >>person"Lucy",15) s>> add_new person (people, person) >>>people ('name': 'Marina', 'Robert', 'Mike', 'siri', 'Alexa', 'Betty', 'Lucy', 'age' (20, 23, 17, 41, 3, 14, 15]) # Your code is here #

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions

Question

Ensure continued excellence in people management.

Answered: 1 week ago

Question

Enhance the international team by recruiting the best people.

Answered: 1 week ago