Nested for loops and print statements
MRAB
python at mrabarnett.plus.com
Mon Sep 26 12:39:53 EDT 2016
On 2016-09-26 16:25, Cai Gengyang wrote:
> I just wanted to note that sometimes the code works, sometimes it doesn't. (even though both are exactly the same code) ... Weird , dum dum dum
>
>>>> for row in range(10):
> for column in range(10):
> print("*",end="")
>
> SyntaxError: inconsistent use of tabs and spaces in indentation
>>>> for row in range(10):
> for column in range(10):
> print("*",end="")
>
[snip]
They are not exactly the same code. They are indented differently (tabs
vs spaces), and that matters in Python.
More information about the Python-list
mailing list