0

I am trying to write a script and I put this down if _name_== '_main_':

Now visual studio code isn't understanding _name_ but I am following a video so I am pretty confused

It gave me an error code that said it was undefined

wjandrea
  • 28,235
  • 9
  • 60
  • 81
  • 6
    Both of those things are supposed to have two underscores on each end, not one... – jasonharper Feb 16 '23 at 22:57
  • why don't you check a website, maybe the official python website, so a web search, even if you type it wrong it will give you useful hits – rioV8 Feb 16 '23 at 22:59
  • The problem has nothing to do with VSC. When you run the code, Python will raise an error. VSC is just warning you ahead of time. – wjandrea Feb 16 '23 at 23:31
  • BTW, welcome to Stack Overflow! Please take the [tour] and read [ask], which has tips like how to write a good title, how to include all the necessary info, and to start with your own research. – wjandrea Feb 16 '23 at 23:33

1 Answers1

0

it should be two underscores instead of one.

if __name__ == "__main__": 
    print("hello")

More information about this can be found here

Mr.Bug
  • 1
  • 1
    Questions that can be resolved by fixing a typo usually get closed and/or deleted pretty quickly as they are [off-topic](/help/on-topic), so it's not recommended to add an answer. – Pranav Hosangadi Feb 17 '23 at 00:50