Last active
October 28, 2016 05:40
-
-
Save lumenwrites/18446c70c382645e54f17b68620cf501 to your computer and use it in GitHub Desktop.
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
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