IndentationError | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

IndentationError

hey, I'm trying to learn python while using my linux terminal (I'm kinda new on this OS) and when i try to write the parto of the code after "print("3")", it just shows me a message that says: 'File "<stdin>", line 2 print("3") \n if num<5: ^ IndentationError: expected an indented block' Can anyone please help me to understand how can I solve this please??

7th May 2017, 12:08 AM
Mauro Basurto
Mauro Basurto - avatar
2 Answers
+ 7
You probably forgot to indent the instruction, and your previous line require a bloc of instruction: a = 42 if a > 0: print("Positive") Thar produce an indent error at line 3, because the if statement require at least one line indented to be into its body, as this: a = 42 if a > 0: print("Positive") ^^
7th May 2017, 4:09 AM
visph
visph - avatar
+ 3
can you post a link for your code in the code playground? To see what is the problem we need to see the code before that print.
7th May 2017, 12:23 AM
Ulisses Cruz
Ulisses Cruz - avatar