skip to Main Content

As the title sugggest I don’t understand why I get the NameError: message. Trying to follow the instructions of Programing with Mosh, a youtuber. Here is a picture of the CODE I am running pythong on visual studio code I have tried restarting visual studio code but that tends 2 fix the problem sometimes, but it is not fixing the problem now.

2

Answers


  1. You seem to be opening a Python console. When you open a console, it is blank, nothing has ran there and no variables are defined. If you run every line of your code from the start, it will work, but not if you just run the last line.

    Instead of opening a Python terminal, you should open a normal terminal or cmd and run your code with "python yourfile.py"

    Login or Signup to reply.
  2. You don’t worry you write a program in python IDLE it easily you have output. Then you write big program you try python editor like PyCharm.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search