You're going on a trip with some students and it's up to you to keep track of how much money each Student has. A student is defined like this:

```python
class Student:
    def __init__(self, name, fives, tens, twenties):
        self.name = name
        self.fives = fives
        self.tens = tens
        self.twenties = twenties
```

As you can tell, each Student has some fives, tens, and twenties. Your job is to return the name of the student with the most money. If every student has the same amount, then return `"all"`.

Notes:
* Each student will have a unique name
* There will always be a clear winner: either one person has the most, or everyone has the same amount
* If there is only one student, then that student has the most money

Difficulty: introductory

Starter code:

def most_money(students):
	

Solutions:
def most_money(students):
    total = []
    for student in students:
        total.append((student.fives * 5) + (student.tens * 10) + (student.twenties * 20))
    
    if min(total) == max(total) and len(students) > 1:
        return "all"
    else:
        return students[total.index(max(total))].name

money = lambda student: 5*student.fives + 10*student.tens + 20*student.twenties

def most_money(students):
    if len(students) == 1: return students[0].name
    D = {money(student):student.name for student in students}
    return "all" if len(D) == 1 else D[max(D)]

def most_money(students):
    BillGatesKid = students[0]
    NumOfStudents = len(students)
    if NumOfStudents == 1:
        return BillGatesKid.name
    for s in students:
        if s.fives * 5 + s.tens * 10 + s.twenties * 20 > BillGatesKid.fives * 5 + BillGatesKid.tens * 10 + BillGatesKid.twenties * 20:
            BillGatesKid = s
        elif s.fives * 5 + s.tens * 10 + s.twenties * 20 == BillGatesKid.fives * 5 + BillGatesKid.tens * 10 + BillGatesKid.twenties * 20:
                NumOfStudents -= 1
                if NumOfStudents == 0:
                    return "all"
    return BillGatesKid.name

def most_money(s):
    d = {i.name:i.fives*5+i.tens*10+i.twenties*20 for i in s}
    return max(d,key=lambda x:d[x]) if len(set(d.values()))!=1 or len(d)==1 else 'all'

class Student:
    def __init__(self, name, fives, tens, twenties):
        self.name = name
        self.fives = fives
        self.tens = tens
        self.twenties = twenties


phil = Student("Phil", 2, 2, 1)
cam = Student("Cameron", 2, 2, 0)
geoff = Student("Geoff", 0, 3, 0)


def most_money(students):
    hajs = [stud.fives * 5 + stud.tens * 10 + stud.twenties * 20 for stud in students]
    return students[hajs.index(max(hajs))].name if hajs.count(max(hajs)) == 1 else "all"

def cashmuny(student):
    return student.fives * 5 + student.tens * 10 + student.twenties * 20
def most_money(students):
    timdeo = students[0]
    all = False
    if len(students) == 1:
        return timdeo.name   
    for s in students[1:]:
        if cashmuny(s) > cashmuny(timdeo):
            timdeo = s
            all = False
        elif cashmuny(s) == cashmuny(timdeo):
            all = True
    if all == False:
        return timdeo.name
    if all == True:
        return "all"

class Wallet(Student):
    def __init__(self, sn):
        super().__init__(sn.name, sn.fives, sn.tens, sn.twenties)
    def get_money_sum(self):
        return sum([self.fives*5, self.tens*10, self.twenties*20])

class Money():
    def __init__(self, students):
        self.sns = students
        self.wallets = [Wallet(sn) for sn in students]
    def sort(self):
       return sorted(((wlt.name, wlt.get_money_sum()) for wlt in self.wallets), key=lambda tup:-tup[1])
        
def most_money(students):
    allmoney = Money(students).sort()
    return allmoney[0][0] if allmoney[-1][1] != allmoney[0][1] or len(allmoney)<2 else 'all'


def most_money(students):
    money = lambda s: s.fives * 5 + s.tens * 10 + s.twenties * 20
    students = sorted(students, key=money, reverse=True)
    if len(students) != 1 and money(students[0]) == money(students[1]):
        return "all"
    return students[0].name

def most_money(students):
    allsame = True
    max = 0
    for s in students:
        smoney = s.fives*5 + s.tens*10 + s.twenties*20
        if max == 0:
            richest, max = s.name, smoney
        elif smoney != max:
            allsame = False
            
        if smoney > max:
            richest, max = s.name, smoney
            
    return "all" if allsame and len(students)>1 else richest

def most_money(students):
    amounts = {s.name: 5*s.fives + 10*s.tens + 20*s.twenties for s in students}
    return "all" if 1 == len(set(amounts.values())) < len(amounts) else max(amounts, key=amounts.get)