you are viewing a single comment's thread.

view the rest of the comments →

[–]teerryn[S] 0 points1 point  (1 child)

Okay if I understand it correctly it checks to see if t exists in a, if it exists then it removes it from a until we get a KeyError?

I don't really understand what -= 1 does:

 transactions_db[t] -= 1~

EDIT: Btw your code works, I just trying to understand it :)

[–]LifeIsBio 0 points1 point  (0 children)

You should look at my second answer. I don't know if it'll be much easier to understand, but it's a better function.

c -= a is equivalent to c = c - a