Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Goal: Learn to remove elements from a dictionary Goal: Learn to dynamically create dictionaries. Assignment: Whole numbers are the numbers 1 , 2 , 3

Goal: Learn to remove elements from a dictionary Goal: Learn to dynamically create dictionaries.
Assignment: Whole numbers are the numbers 1,2,3, and so on. Write some code that assigns
to inverted a dictionary that maps the first n whole numbers to their inverse (1n).squares ={} square = number **2return squares
n =5
squares = create_squares_dict(n)Question 4
Feedback
More information
{1:1,2:4,3:9,4:16,5:25}
Feedback:
Expected variable 'inverted' to exist tuple_2=(1,2,3)
dct = dict(zip(tuple_1, tuple_2))
{'a': 1,'b': 2,'c': 3}Question 5
(\times ) Feedback
More information
No output.
Feedback:
Expected dct to equal {1: 'A',2: 'E',3: 'I',4: 'O',5: 'U'} but got {'a': 1,'b': 2,'c': 3}.
Assignment: Assume the variable iso_3166 refers to a dictionary mapping each country's name
to its Alpha-2 code. Write some code that deletes the element with key "East Timor" and sets its
mapped value to the new key "Timor-Leste".iso_3166["Timor-Leste"]= "East Timor"Question 3
Feedback
More information
No output.
Feedback:
Expected key 'East Timor' to not exist
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions