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
# ask user for amount | |
# ask user for Unit | |
# check that unit is in dictionary | |
# if unit in dictionary, convert to mL | |
# if no unit is given / unit is unknown, leave as is | |
unit_central = { | |
"tsp": 5, |
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
# Ingredients list | |
# Number Checking Function | |
def num_check(question): | |
error = "Please enter a number that is more than zero" | |
valid = False | |
while not valid: | |
response = input(question) |
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
# Ingredients list | |
# Number Checking Function | |
def num_check(question): | |
error = "Please enter a number that is more than zero" | |
valid = False | |
while not valid: | |
try: |
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
# Functions go here | |
def num_check(question): | |
error = "Please enter a number that is more than zero" | |
valid = False | |
while not valid: | |
try: | |
response = float(input(question)) | |
if response <= 0: |
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
# Functions go here | |
def num_check(question): | |
error = "Please enter a number that is more than zero" | |
valid = False | |
while not valid: | |
try: | |
response = float(input(question)) | |
if response <= 0: |
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
# Functions go here | |
# Main Routine goes here | |
serving_size = float(input("What is the recipe serving size? ")) | |
desired_size = float(input("How many servings are needed? ")) | |
scale_factor = desired_size / serving_size | |
print("Scale factor: {}".format(scale_factor)) |
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
# Get's recipe and checks it is not blank | |
# Not Blank Function goes here | |
def not_blank(question): | |
error = "Your recipe name has numbers in it." | |
valid = False | |
while not valid: | |
response = input(question) | |
has_errors = "" |
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
# Get's recipe and checks it is not blank | |
# Not Blank Function goes here | |
def not_blank(question): | |
valid = False | |
while not valid: | |
response = input(question) | |
if response == "": | |
continue |