Created
June 8, 2020 00:14
-
-
Save jenheller/c19de59be8ef1473197e6088344f9c41 to your computer and use it in GitHub Desktop.
My coffee bot I created for Codecademy
This file contains 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
# Define your functions | |
def coffee_bot(): | |
print("Welcome to the cafe!") | |
size=get_size() | |
drink_type=get_drink_type() | |
temp=hot_or_iced() | |
print("Alright, that\'s one {} {} {}!".format(temp,size,drink_type)) | |
name=input("May I have your name please? ") | |
print("Thanks, {}! Your drink will be ready shortly.".format(name)) | |
def get_size(): | |
res = input('What size drink would you like? \n[a] Small \n[b] Medium \n[c] Large \n') | |
if res == 'a': | |
return 'small' | |
elif res == 'b': | |
return 'medium' | |
elif res == 'c': | |
return 'large' | |
else: | |
print_message() | |
return get_size() | |
def print_message(): | |
print("I'm sorry, I did not understand your selection. Please enter the corresponding letter for your response.") | |
def get_drink_type(): | |
res = input('What type of drink would you like? \n[a] Brewed Coffee \n[b] Mocha \n[c] Latte \n') | |
if res == 'a': | |
return "brewed coffee" | |
elif res == 'b': | |
return "mocha" | |
elif res == 'c': | |
return order_latte() | |
else: | |
print_message() | |
return get_drink_type() | |
def order_latte(): | |
res = input('What kind of milk would you like in your latte? \n[a] 2% milk \n[b] Non-fat milk \n[c] Soy milk \n') | |
if res == 'a': | |
return "latte" | |
elif res == 'b': | |
return "non-fat latte" | |
elif res == 'c': | |
return "soy latte" | |
else: | |
print_message() | |
return order_latte() | |
def hot_or_iced(): | |
res=input("Would you like your drink hot or iced? \n[a] Hot \n[b] Iced \n") | |
if res == "a": | |
return "hot" | |
elif res == "b": | |
return "iced" | |
else: | |
print_message() | |
return hot_or_iced() | |
# Call coffee_bot()! | |
coffee_bot() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment