Skip to content

Instantly share code, notes, and snippets.

@aambrioso1
Created August 26, 2019 04:06
Show Gist options
  • Save aambrioso1/b593067012e6cf0049f7fda09b9af0e6 to your computer and use it in GitHub Desktop.
Save aambrioso1/b593067012e6cf0049f7fda09b9af0e6 to your computer and use it in GitHub Desktop.
recycle.py
# Project
def drinks(e,f,c):
total = 0
while((e + f) >= c): # Do we have enough empties?
d = (e + f)//c # How many can Tom buy?
f = (e + f) % c # How many leftover?
total += d # How many did Ton drink this time?
e = d # More empty bottle
return total
print('For 9 0 3 Tom drinks: ', drinks(9,0,3))
print('For 5 5 2 Tom drinks: ', drinks(5,5,2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment