Oct-24-2020, 03:46 AM
The variable
coffee
is defined inside the chooseCoffee()
function. You can't refer to that variable outside the function. If you want to use information returned from the function you need to assign it to a variable. You could even make that variable coffee
, but I'm going to use a different name to show it instead.mycoffee = chooseCoffee() # information stored in mycoffee in this section of code if mycoffee == "iced coffee": # don't need parenthesis here print('Cashier: "Iced coffee it is!"')