Created
August 26, 2019 04:06
-
-
Save aambrioso1/b593067012e6cf0049f7fda09b9af0e6 to your computer and use it in GitHub Desktop.
recycle.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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