Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Feed Pigeons solution in Clear category for Feed Pigeons by CounterSparta
def checkio(food):
pingeons, increment, fed = 0, 0, 0
while food>fed:
increment += 1
pingeons += increment
fed = min(pingeons,food)
food -= pingeons
return fed
#These "asserts" using only for self-checking and not necessary for auto-testing
if __name__ == '__main__':
assert checkio(1) == 1, "1st example"
assert checkio(2) == 1, "2nd example"
assert checkio(5) == 3, "3rd example"
assert checkio(10) == 6, "4th example"
Nov. 23, 2014
Comments: