Here's an example of how you could find the average of all values in a Python dictionary (which is similar to a map in other languages) using the built-in mean
function from the statistics
module:
main.py332 chars13 lines
Output:
main.py52 chars2 lines
Alternatively, you could calculate the average manually using a loop:
main.py338 chars13 lines
Output:
main.py52 chars2 lines
gistlibby LogSnag