If statement Syntax error

Hi, I’m following the freecamp Learn Python - Full Course for Beginners [Tutorial], and Im learning about if statements. I’m copying the ‘if’ exactly as written and getting a syntax error. I’m aware of the trans question raging in the uk but this is what he wrote, so please don’t give me grief

is_male = True

if is_male:
print (“You are a male”)

It says 'if is_male 'is a syntax error. Can someone explain why I’m getting that error and help me understand it and get past it please?

Thanks in advance

When copypasted your code and run it, it gave syntax error because of quotes.
I deleted original quotes and just added quotes again - that did it.

To be fair I am not sure why quotes from code are invalid

Ah, and I added indentation - the code you posted is not indented

1 Like

i was making code for a discord bot via youtube video but the website i’m using to code updated since then
i typed in the code:

if message.content.startswith(‘\yo’):
await message.channel.send(‘Hey’)

and it returned as a syntax error in the image attached (on the right of the image in the red text)

i enabled message content intent for the bot as well, so i don’t understand what’s wrong with the code.

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