Coffee Bot Project: print function defined but message not showing up

I am working on the Coffee Bot Python Project. I defined the print function above the get_size function. Then I call the print function inside the get_size function, however, the message is not printed when the program is run.

# Define your functions
def coffee_bot():
  print('Welcome to the cafe!')

  size = get_size()
  print(size)

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()

# Call coffee_bot()!
coffee_bot()

Is there a reason you write a print_message() function instead of just moving the print() statement it contains into get_size() where appropriate?

However, the only reason it shouldn’t be printing, is if you input 'a','b', or 'c'. I run your code and get the desired result in all cases.

If I remember correctly, the project requires you to define that function because it is used again later on.
As for the code it works fine for me too.

I literally opened up the terminal and ran it today and it was fine. Maybe I should log out of codecademy and log back in. Anyways thanks!

1 Like