RE: How exactly does not work, especially if we write not not?

my_name = what is my name

print my_name

why do this code return SyntaxError: invalid syntax

Do you see anything wrong with how you saved the string the variable and how you wrote the print statement?

1 Like

What about the line before that?


Let’s see… you got a SyntaxError with a message saying invalid syntax.

Syntax refers, in human language, to the way that words are put together to form sentences or phrases. If the syntax is incorrect, your sentence will not sense make.

It’s the same for programming (“computer”) languages: you messed something up in how you wrote the code.

The issue is not very clear based on the error message alone because the interpreter (software that reads your code) doesn’t quite know what the issue is either. We’re going to have to do some digging.

You’ll have learned by now what a string is, along with how it should be formatted. This contrasts with how keywords are (not) formatted. Here, I’ll tell you that the issue is that you’ve formatted your my_name value as a bunch of keywords instead of a string. The software is therefore trying to read it as if it were code, not a value.

do_you = "see what i mean?"