Nested for loops and print statements

Larry Hudson orgnut at yahoo.com
Mon Sep 26 15:56:59 EDT 2016


On 09/26/2016 08:25 AM, 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
>

It is NOT weird.  Python is being consistent, YOU are not.

These examples are NOT "exactly the same code"!  The indenting is different.  Python (correctly) 
treats them as being different.

YOU MUST USE CONSISTENT INDENTING.  You MUST always use spaces (the recommended) or always use 
tabs.  Never, ever, not at any time, can you mix them.

(Now, does that emphasize the point enough?)  Go back and REWRITE your code with CONSISTENT 
indenting.

-- 
      -=- Larry -=-



More information about the Python-list mailing list