Get the error in a simple algorithm for the problem on codewars. John — clerk?

The problem itself:

My code:
def tickets(people):
 money = 0

 for ticket in people:
 if ticket == 25:
 money += ticket
 if money >= ticket:
 money += 25
 money= ticket - 25
 return "NO"

 return "YES"

Why do I get errors?
April 3rd 20 at 18:30
2 answers
April 3rd 20 at 18:32
and what error are you getting? I think this is due to the fact that you think 2 times the cost of the ticket - 1) add to the money and 2) subtracted from the ticket. Try not deducted from the ticket 25
April 3rd 20 at 18:34
if money >= ticket:
 money += 25
 money= ticket - 25

With each customer added paid the bill minus change, i.e. the 2nd line should be money += ticket, thus reducing both strings to the money += 25, which is logical, because we sold every ticket increase cash just for the price of the ticket.
But then there's another problem with this approach: it ignores the denominations of banknotes in the cash register. For example, for the sequence [25, 25, 50, 50, 100] to the last buyer in cash will be $ 100, but the change to pay can not, because it's 2 50s. Therefore, we need to consider not just the amount of cash, and the denominations.

Find more questions by tags Python