Skip to content

Instantly share code, notes, and snippets.

@pamelafox
Last active August 26, 2021 17:10
Show Gist options
  • Save pamelafox/962bffbe81789c7f318f3458d985df65 to your computer and use it in GitHub Desktop.
Save pamelafox/962bffbe81789c7f318f3458d985df65 to your computer and use it in GitHub Desktop.
Lifetime supply
"""
Ever wonder how much a "lifetime supply" of your favorite snack is? Wonder no more!
Write a function named calculate_supply that:
* takes 2 arguments: age, amount per day.
* calculates the amount consumed for rest of the life (based on a constant max age of 81).
* returns the result
"""
# This def statement may be incomplete...
def calculate_supply():
"""
>>> calculate_supply(80, 1)
365
>>> calculate_supply(80, 2)
730
>>> calculate_supply(36, 3)
49275
# Bonus: Accept floating point values for amount per day, and round the result up to an integer.
>>> calculate_supply(37, 2.17)
34850
"""
# YOUR CODE HERE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment