school

thing1's amazing school repo
Log | Files | Refs | Submodules | README

commit 0969ab34e656ca044745d73a76642a8d9613b72e
parent 0da8ff2d13c0d0c448444bc8f4ad13459a97aa23
Author: standenboy <standenboy@StandenboyLAP.lan>
Date:   Wed, 24 Jan 2024 13:33:00 +0000

added homework

Diffstat:
Acomp/hw/111/students.py | 48++++++++++++++++++++++++++++++++++++++++++++++++
Acomp/work/20/flowchart.png | 0
Ascreen.core | 0
3 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/comp/hw/111/students.py b/comp/hw/111/students.py @@ -0,0 +1,48 @@ +students = [['alice', [75,80,85,90]], ['bob',[60,65,70,75]],['charlie',[90,85,80,78]]] + + +def calculate_mean(name): + for i in students: + if i[0] == name: + mean = sum(i[1]) / len(i[1]) + return mean + return "not in list" + +def top_student(): + top = 0 + for i in students: + this_student_mean = calculate_mean(i[0]) + if this_student_mean > top: + top = this_student_mean + for i in students: + if calculate_mean(i[0]) == top: + return i[0] + +def grade_spread(): + print(''' + 90+ 2 + 80+ 4 + 70+ 2 + 50+ 0 + <50 0 + ''') + +def improvement(name): + for i in students: + if i[0] == name: + low = i[1][0] + high = 0 + for i in i[1]: + if i < low: + low = i + elif i > high: + high = i + range = high - low + return range + return "not in list" + + +print(calculate_mean("charlie")) +print(top_student()) +grade_spread() +print(improvement("alice")) diff --git a/comp/work/20/flowchart.png b/comp/work/20/flowchart.png Binary files differ. diff --git a/screen.core b/screen.core Binary files differ.