Trying to understand nested loops
Grant Edwards
grant.b.edwards at gmail.com
Fri Aug 5 15:53:59 EDT 2022
On 2022-08-05, GB <NOTsomeone at microsoft.invalid> wrote:
>> BTW, there is an indentation error in your original post - line 5
>> should line up with line 4.
>
> As a Python beginner, I find that Python is annoyingly picky about
> indents. And, the significance of indents is a bit of a minefield for
> beginners.
As a C beginner, you'll find that C is annoyingly picky about curly
braces and semcolons.
All programming languages are picky about syntax.
> For example, in the above code, the indent of the final line very
> significantly affects the results:
>
> print(var)
> print(var)
> print(var)
>
> These are all different.
Indeed. It looks different, and it _is_ different. Seems like a good
thing to me. I like programs to do what it looks like they are going
to do.
In C, this doesn't do what it looks like it's supposed to do.
if (foo)
do_this();
and_this();
then_do_this();
More information about the Python-list
mailing list