Skip to content

Instantly share code, notes, and snippets.

@lumenwrites
Last active October 28, 2016 05:40
Show Gist options
  • Save lumenwrites/18446c70c382645e54f17b68620cf501 to your computer and use it in GitHub Desktop.
Save lumenwrites/18446c70c382645e54f17b68620cf501 to your computer and use it in GitHub Desktop.
def slice_pizza(number_of_friends, number_of_slices):
# Cut pizza in half
number_of_slices = number_of_slices*2
# Is there enough slices for everybody?
if number_of_slices >= number_of_friends:
# If yes - return our slices, it's time to eat pizza!
return number_of_slices
else:
# If not - then cut it in half once again.
return slice_pizza(number_of_friends, number_of_slices)
print(slice_pizza(15, 1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment