Could somebody help me with this error? It said I did something wrong in line 10, but I can’t figure out where I did wrong! Thank you so much!
Apologies but it’s quite hard to see from the picture. Could you possibly post the formatted code either on the forums or on pastebin/ a gist or similar.
A link to the project would also be helpful, ta.
Sorry for the inconvenience! here is the code that I wrote for the project!
Define your functions
def coffee_bot():
print(‘Welcome to the cafe!’)
size = get_size()
drink_type = get_drink_type()
print(‘Alright, that’s a {} {}!’.format(size, drink_type)
name = input(“Can I get your name please?”)
print(‘Thanks, {}! Your drink will be ready shortly.’.format(name))
def print_message():
print(“I’m sorry, I did not understand your selection. Please enter the corresponding letter for your response.”)
def get_size():
res = input("What size drink can I get for you? \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 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(“And what kind of milk for 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()
Call coffee_bot()!
coffee_bot()
let me know if that helps to clarify a bit!
In the coffee_bot
function on line 6, you need to add a closing parenthesis:
print("Alright, that’s a {} {}!".format(size, drink_type))
And in the order_latte
function on line 42 change, if res = "a"
to:
if res == "a"