What Does The Error 'indentationerror: Expected An Indented Block In Python' Mean?
Consider following short Python program: i= 21; j= 23; print (i); if i>j : print ('greater') else : print 'lesser' It is giving the error IndentationError: expected an indente
Solution 1:
You need to indent statements that are intended to be in if-else
blocks:
i = 21
j = 23
print (i)
if i > j:
print('greater')
else:
print('lesser')
Solution 2:
Any time you have a colon, you follow it with an indented block of text. Everything in that block applies to the thing with the colon (which could be a function that you're defining, an if-statement, for-loop, etc). Indents should be 4 spaces (tabs also work).
Also, you don't need semicolons at the end of each line.
Example:
def function(parameter):
block line 1
block line 2printfunction(argument)
Post a Comment for "What Does The Error 'indentationerror: Expected An Indented Block In Python' Mean?"