OpenSesame
Rapunzel Code Editor
DataMatrix
Support forum
Python Tutorials
MindProbe
Python videos

Modules: Exercises and Solutions

Some simple statistics

Exercise

Use the statistics module to calculate the mean of all prime numbers below 10.

Solution

import statistics

prime_numbers = [1, 3, 5, 7]
m = statistics.mean(prime_numbers)
print('M = {0}'.format(m))

Output:

M = 4

You're done with this section!

Continue with Modules >>