No result for Coffee Project

Hello,
I’ve seen there is no result coming up after saving the code for the coffee project for the course of chatbots with Python. What kind of changes should I make in the code below? Thanks in advance.

# 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? \n>')

  print ('Thanks,{}! Your drink will be ready shortly.' .format(name))

  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:
      def print_message():
        print("I'm sorry, I did not understand your selection. Please enter the corresponding letter for your response.")
      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()

I can’t work out if your indentation has gone wrong when pasting or function definitions are actually defined within if statements (which is uncommon and probably unnecessary for this task). Any chance you could check the indentation and fix anything that’s out of place (either edit or add a reply). A link to the project would also be handy.

Thank you for working on the problem. Upon the request, there is a link to the project. https://gist.github.com/0e9f38717b50d0c7334ac4d1c692fcbb

Let me know if you still have a trouble to run the code.

Thank you.

That doesn’t appear to have changed the indentation. Unless you have a good reason to do so I’d avoid nesting your functions. You have functions defined within functions, within if statements and all sorts. It is very hard to work out what’s going on. Remember than indentation is used in Python to define code blocks. It is not arbitrary whitespace before the code.

Have you covered functions in Python? If you’ve not done so before I’d really suggest looking into it now. Rearranging this code such that the functions are defined separately and your main coffee_bot function merely calls the other functions would make your code much simpler, e.g.

def func2():
    return 1
def func3():
    return 1

def func(arg):
    func2()
    func3()

Your suggestions seem constructive. Thank you. If you have a chance to take a look at the Coffee Project, then you would realize that my coding is not much difference than the solution. Yes, there is a solution posted for us to learn. So your suggestion might loop back to the course instructor whether they should make the code much simpler and easier.

My question is still open and not solved yet.

Until you fix the indentation I do not expect your code to work.