|
|
- #!/usr/bin/env python3
- #title :7-3.py
- #description :Opdracht 7.3 - Two-dimensional lists
- #author :Marcel Haazen
- #email :marcel@haazen.xyz
- #date :04-10-2019 - 21:25
- #version :0.1
- #usage :python3 7-3.py
- #notes :
- #python_version :3.7.4
- #==============================================================================
- import numpy as np
- studentencijfers = [[95, 92, 86],[66, 75, 54],[89, 72, 100],[34, 0, 0]]
-
- def gemiddelde_per_student(studentencijfers):
- antw = np.array(studentencijfers)
- antw = antw.mean(axis=1, dtype=np.float64)
- return antw
-
- def gemiddelde_van_alle_studenten(studentencijfers):
- antw = np.array(studentencijfers)
- antw = antw.mean(axis=1)
- antw = np.array(antw)
- antw = antw.mean()
- return antw
-
- print(gemiddelde_per_student(studentencijfers))
- print(gemiddelde_van_alle_studenten(studentencijfers))
|