Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

2. Create an old sample dictionary {0:10,1:20} as follows to store numbers. Write a Python script to ask how many runs from user input to

image text in transcribed

2. Create an old sample dictionary {0:10,1:20} as follows to store numbers. Write a Python script to ask how many runs from user input to add items to the old dictionary. Use a loop to append these key/value pairs to the dictionary. Print out the resulting dictionary for each run (NOT just the last run). Please find the number patterns to append key/value pairs. You cannot add the numbers manually. Print the result out as follows. Old dictionary is: {0:10,1:20} How many runs do you want to add items for dictionary? 3 After the \#1 run, the New dictionary is: {0:10,1:20,2:30} After the \#2 run, the New dictionary is: {0:10,1:20,2:30,3:40} After the \#3 run, the New dictionary is: {0:10,1:20,2:30,3:40,4:50} Old dictionary is: {0:10,1:20} How many runs do you want to add items for dictionary? 5 After the \#1 run, the New dictionary is: {0:10,1:20,2:30} After the \#2 run, the New dictionary is: {0:10,1:20,2:30,3:40} After the \#3 run, the New dictionary is: {0:10,1:20,2:30,3:40,4:50} After the \#4 run, the New dictionary is: {0:10,1:20,2:30,3:40,4:50,5:60} After the \#5 run, the New dictionary is: {0:10,1:20,2:30,3:40,4:50,5:60,6

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

Recommended Textbook for

Graph Databases New Opportunities For Connected Data

Authors: Ian Robinson, Jim Webber, Emil Eifrem

2nd Edition

1491930896, 978-1491930892

More Books

Students explore these related Databases questions