Print() is a function, but is being called inside another function. Is this okay?



Within the context of this exercise, we placed a print() function within another function. Is it okay to place function calls inside another function?


Yes, you have functions calls within another function. You can think of functions as generally being a collection of multiple lines of code. These lines can be statements, expressions, and even other function calls.

When you run a function that calls another function, it will go through its code lines as usual, and when it gets to the function call, it will complete that call, and then continue with its next lines of code as usual.


def sayHi():

def sayWords():
  sayHi() # The function call will run and complete.

  # After the function call above completes, then Python
  # will continue with the next code lines in the function.
  print("How are you?")