syntax error
I am working through the introduction to Python.
I am on a Macintosh.
The very first project contains this line:
if __name__ == '__main__':
I get a syntax error for this, and some variations when I try to run the project. How can I fix this? Are the underscores supposed to be double underscores? I've tried both.
Please sign in to leave a comment.
This might have something to do with macintosh, I'm on Windows 10 and I juste copy pasted your bit of code and put a print in the if statement and it seems to work perfectly.
Or maybe, do you have any code in your if statement? if not, that would explain the syntax error. Python expects you to have a second line with a 4 spaces indentation level after this one.
I do have code following it.
The next line, indented, is
Here's my code:
Hello,
Do you have "If" or "if" ? The upper-case matters, please let me know if that is the case.