Question: Dictionary Update Assignment a Write a program that prompts the user for test scores, stores them in a dictionary, and averages the scores. - Write
Dictionary Update Assignment a
Write a program that prompts the user for test scores, stores them in a dictionary, and averages the scores.
Write a function gettestscores
Create an empty dictionary scoresdict dict
Prompt the user to input the number of test scores, store in numscores
Write a loop to get each of the numscores test scores
Prompt the user to input each test score and store in score. Validate the input!
Add score to scoresdict # HINT: update the dictionary
Write a second function averagescores that accepts the dictionary as the only parameter and returns the average scores
Use len to determine your numscores for calculation
Note a dictionary is a set of key, value pairs.
You can get the keys with keys function
You can access the value using a key variable scoresdict.getk
What about testing?
Write a main to test your functions
Unit Tests can also help test averagescores
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
