Skip to content

Instantly share code, notes, and snippets.

@joshlawrence
Created June 14, 2021 19:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshlawrence/e8229cc992c2c4add76c769fd8fa0e5a to your computer and use it in GitHub Desktop.
Save joshlawrence/e8229cc992c2c4add76c769fd8fa0e5a to your computer and use it in GitHub Desktop.
Ashley's Homework
#!/usr/bin/env python3
# get the amounts of each ingredient
lemon_juice_cups = float(input('Enter amount of lemon juice (in cups)'))
water_cups = float(input('Enter amount of water (in cups)'))
agave_nec_cups = float(input('Enter amount of agave nectar (in cups)'))
num_servings = float(input('How many servings does this make?'))
# print the amounts formatted to 2 decimal places
print('Lemonade ingredients - yields', '{:.2f}'.format(num_servings), 'servings')
print('{:.2f}'.format(lemon_juice_cups, 'cup(s) lemon juice'))
print('{:.2f}'.format(water_cups, 'cup(s) water'))
print('{:.2f}'.format(agave_nec_cups, 'cup(s) agave nectar'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment