From c00cbd030b5d2980bda9d8681a0a4a9ba0819f04 Mon Sep 17 00:00:00 2001 From: zimmersandro Date: Tue, 10 Mar 2026 16:36:56 +0100 Subject: [PATCH] feat: kata 'Who has the most money' compleated. --- src/codewars/kata_who_the_most_money.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/codewars/kata_who_the_most_money.py diff --git a/src/codewars/kata_who_the_most_money.py b/src/codewars/kata_who_the_most_money.py new file mode 100644 index 0000000..a521421 --- /dev/null +++ b/src/codewars/kata_who_the_most_money.py @@ -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]