print(‘Welcome to the cafe!’)
measurement = get_size()
drink_type = get_drink_type()
print(f”Alright, that’s a {measurement} {drink_type}!”)
title = enter(“Can I get your title please?n> “)
print(f”Thanks, {title}! Your drink will likely be prepared shortly.”)
def get_size():
res = enter(“What measurement drink can I get for you? n[a] Small n[b] Medium n[c] Massive n> “)
if res == ‘a’:
return ‘small’
elif res == ‘b’:
return ‘medium’
elif res == ‘c’:
return ‘massive’
else:
print_message()
return get_size()
def print_message():
print(“I am sorry, I didn’t perceive your choice. Please enter a legitimate possibility.”)
def get_drink_type():
res = enter(“What kind of drink would you want? n[a] Brewed Espresso n[b] Mocha n[c] Latte n> “)
if res == ‘a’:
return ‘brewed espresso’
elif res == ‘b’:
return ‘mocha’
elif res == ‘c’:
return order_latte()
else:
print_message()
return get_drink_type()
def order_latte():
res = enter(“What sort of milk 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()
# Run the espresso bot
coffee_bot()