Python not assigning variables

def sayHello():
    print("Hello World")

sayHello()

sayHello()
Traceback (most recent call last):
File “”, line 1, in
NameError: name ‘sayHello’ is not defined

Why???

I just tried again from my personal comp-
Same result:

It looks as if your executing the code with python ide in visual studio. You will need to change to the directory in which the script is located or run it with visual studios execution function

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.