I'm currently studying Python at a new company, but unlike other languages, Python can cause errors or not be processed correctly just by shifting the indentation.
In the sample.py below, the output result will be answer.py.
sample.py
for i in range(10):
if i == 1:
continue
if i == 8:
break
print(i)
answer.py
0
2
3
4
5
6
7
However, in the following sample2.py, which is out of indentation, no error occurs, but print (i) is not output because the indentation is out of alignment.
sample2.py
for i in range(10):
if i == 1:
continue
if i == 8:
break
print(i)
Recommended Posts