+ 2

Why does Python hate me?

The 'if' code always seems to bring up "IndentationError: expected an indented block". How do I go to a new line without Python complaining to me about this indentation error? An example: if 2 + 5 == 6 print("yes") However, when I click on "Enter" on my keyboard to go to a new line, it gives me that error. I want to add an 'else' or 'elif' option, but Python won't let me.

24th Oct 2018, 1:57 PM
Craig
2 Respostas
+ 4
there must be one indented line block after if statement do a tab before print and a colon at the end of if line if 2+5 == 6: print("yes")
24th Oct 2018, 2:04 PM
Mbrustler
Mbrustler - avatar
+ 1
Thank you, Mbrustler. 😀
24th Oct 2018, 2:22 PM
Craig