Python/error debug

NameError: name 'greet' is not defined

kimble2 2024. 8. 10. 10:00
반응형

Calling a Function or Module Before It's Defined

Problematic Code:

 

greet()

def greet():
    print("Hello, World!")

Error Message:

 

NameError: name 'greet' is not defined

 

Solution: You must define the function or module before calling it.

 

def greet():
    print("Hello, World!")

greet()

 

 

반응형