+ 2
How do we know if a statement is nested into another statement in python??
4 ответов
+ 3
Thanks a lot
+ 4
I think that you must study about the indentation gap . It works in many of the programing languages along with python.
+ 3
By indentation. As in:
if 1<2:
if 6==6:
print('program ends')
indent is a small gap as you can see in line 2 where a small gap is left behind (if) which shows that it is nested.
+ 2
By checking the length of space.
if:
if:
for:
while:
Like that, it's nested.