On 06/08/2022 10.50, Dan Stromberg wrote: > On Fri, Aug 5, 2022 at 12:35 AM <ojomooluwatolami...@gmail.com> wrote: ...
> Of if you don't have (or want) a debugger, you could change it to: > > var = 0 > for i in range(3): > print('i is', i) > for j in range(-2,-7,-2): > print('j is', j) > var += 1 > print(var) > > And note that 3 times 3 is 9. Combining the above advice and illustration, with several more recent comments about indentation revealing structure, should the above be amended to: indent = " " # your choice of how many spaces/tabs ... print( "i is", i ) ... print( indent + "j is", j ) ... print( indent + indent, var ) # add sep="" if pernickety ... Thus, the output matches the code and each complements the other's view of structure! -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list