You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 rivejä
912 B

5 vuotta sitten
  1. #!/usr/bin/env python3
  2. #title :7-3.py
  3. #description :Opdracht 7.3 - Two-dimensional lists
  4. #author :Marcel Haazen
  5. #email :marcel@haazen.xyz
  6. #date :04-10-2019 - 21:25
  7. #version :0.1
  8. #usage :python3 7-3.py
  9. #notes :
  10. #python_version :3.7.4
  11. #==============================================================================
  12. import numpy as np
  13. studentencijfers = [[95, 92, 86],[66, 75, 54],[89, 72, 100],[34, 0, 0]]
  14. def gemiddelde_per_student(studentencijfers):
  15. antw = np.array(studentencijfers)
  16. antw = antw.mean(axis=1, dtype=np.float64)
  17. return antw
  18. def gemiddelde_van_alle_studenten(studentencijfers):
  19. antw = np.array(studentencijfers)
  20. antw = antw.mean(axis=1)
  21. antw = np.array(antw)
  22. antw = antw.mean()
  23. return antw
  24. print(gemiddelde_per_student(studentencijfers))
  25. print(gemiddelde_van_alle_studenten(studentencijfers))