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 get_test_scores()
- Create an empty dictionary scores_dict \(=\) dict()
- Prompt the user to input the number of test scores, store in num_scores
- Write a loop to get each of the num_scores test scores
- Prompt the user to input each test score and store in score. (Validate the input!)
- Add score to scores_dict \# HINT: update the dictionary
- Write a second function average_scores() that accepts the dictionary as the only parameter and returns the average scores
- Use len() to determine your num_scores 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 scores_dict.get(k)
- What about testing?
- Write a main to test your functions
- Unit Tests can also help test average_scores()
Dictionary Update Assignment a Write a program

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!