task3 #2

Merged
schmidmarco merged 40 commits from task3 into main 2026-03-13 10:11:18 +01:00
Showing only changes of commit c00cbd030b - Show all commits

View File

@ -0,0 +1,15 @@
class Student:
def __init__(self, name, fives, tens, twenties):
self.name = name
self.fives = fives
self.tens = tens
self.twenties = twenties
def most_money(students):
student_names = [x.name for x in students]
student_money = [x.fives * 5 + x.tens * 10 + x.twenties * 20 for x in students]
if len(set(student_money)) == 1 and len(student_money) > 1:
return "all"
return max(list(zip(student_names, student_money)), key=lambda x: x[1])[0]