Question: 2. Filename: assign2-2.py Create an old sample dictionary {0:10, 1:20}. Write a Python script to take the number of runs from cmd to add items

2. Filename: assign2-2.py Create an old sample dictionary {0:10, 1:20}. Write a Python script to take the number of runs from cmd 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. H:\>python C:\Users aslsabbaghpourhokma Documents\IT2431\Module2\assign2-2.py 3 The old dictionary is: {0: 10, 1: 20} 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} H:\>python C:\Users aslsabbaghpourhokma\Documents\IT2431\Module2\assign2-2.py 5 The old dictionary is: {@: 10, 1: 20} 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: {@: 10, 1: 20, 2: 30, 3: 40, 4: 50, 5: 60, 6: 70}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
