should the functions be defined before it is used? but why the following code works:
def main(): dog() def dog(): print(\"This is a dog.\") if __name__
Actually it's not (defined after it's called). This script will do the following:
At that point dog is already known in global scope and main can call it.
dog
main