In some languages, we can have empty (do nothing) blocks like below.
if a==ture
{
//do something
}
else
{
//do nothing
}
#Python doesn't support empty blocks.
In python, following block gives error
a = True
if a is True:
print ('condition is true')
else:
if a==ture
{
//do something
}
else
{
//do nothing
}
#Python doesn't support empty blocks.
In python, following block gives error
a = True
if a is True:
print ('condition is true')
else:
A 'pass' will need to be used in such cases.
a = True
if a is True:
print ('condition is true')
#a block without any statements is invalid in python. In such cases,
# we need to use 'pass'
else:
pass
Note: this is one of the reason why 'pass' is needed. There may be others.