+ 1

Syntax error

I writed the following code from the examples and saved it as test1.py: spam = 7 if spam > 5: print ("five") if spam > 8: print ("eight") after that I runed it python.3.6.4 Idle shell and I got the following error: expected an indanted block

13th Jan 2018, 4:24 PM
Szabo Ferencz Levente
Szabo Ferencz Levente - avatar
3 ответов
+ 2
indentation separate the block of code ex: in this code if block need to be separated from rest of the code similar like { }brace usage in C language..
13th Jan 2018, 4:54 PM
Somasundaram R
Somasundaram R - avatar
+ 1
in python the code in if/else statement must be indented, that means yoy have to put a TAB before it (or spaces) if some: dosomething() not if some: dosomething()
13th Jan 2018, 4:28 PM
michal
0
just figured it out myself also "googled what indanted mens" now it works thanks for the quik answer
13th Jan 2018, 4:30 PM
Szabo Ferencz Levente
Szabo Ferencz Levente - avatar