Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"Can you program?" "Well, I'm literate, if that's what you mean!"


devel / comp.lang.python / Re: Trying to understand nested loops

SubjectAuthor
o Re: Trying to understand nested loopsdn

1
Re: Trying to understand nested loops

<mailman.208.1659741343.20444.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19123&group=comp.lang.python#19123

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: PythonL...@DancesWithMice.info (dn)
Newsgroups: comp.lang.python
Subject: Re: Trying to understand nested loops
Date: Sat, 6 Aug 2022 11:15:26 +1200
Organization: DWM
Lines: 35
Message-ID: <mailman.208.1659741343.20444.python-list@python.org>
References: <D50821A2-0B73-478B-8898-6858122D27B7@gmail.com>
<CAGGBd_pHikuuYDJmVTdNrxwEeG5H3c5X_8YOmziqhTiU03SB_Q@mail.gmail.com>
<97365836-784a-f9f1-00f0-1d4420340d11@DancesWithMice.info>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de iEpL/l2+gExqBnypUzpBFgXHeWTq3ul2pdfO6lqOs52g==
Return-Path: <PythonList@DancesWithMice.info>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=danceswithmice.info header.i=@danceswithmice.info
header.b=Vlk4G7B3; dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.002
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'comments': 0.03; '2022':
0.05; 'aug': 0.07; 'matches': 0.07; '=dn': 0.09; 'dan': 0.09;
'from:addr:danceswithmice.info': 0.09; 'from:addr:pythonlist':
0.09; 'subject:Trying': 0.09; 'indentation': 0.16; 'is",': 0.16;
'message-id:@DancesWithMice.info': 0.16; 'print(': 0.16;
'range(3):': 0.16; 'received:51.254': 0.16; 'received:51.254.211':
0.16; 'received:51.254.211.219': 0.16; 'received:cloud': 0.16;
'received:rangi.cloud': 0.16; 'subject:nested': 0.16; 'wrote:':
0.16; 'to:addr:python-list': 0.20; 'fri,': 0.22; 'code': 0.23;
'output': 0.28; 'header:User-Agent:1': 0.30;
'header:Organization:1': 0.31; 'header:In-Reply-To:1': 0.34;
'change': 0.36; 'received:192.168': 0.37; 'could': 0.38; 'should':
0.40; 'view': 0.60; 'above': 0.62; 'to:': 0.62; 'received:51':
0.64; 'structure,': 0.64; 'your': 0.64; 'times': 0.69; '....':
0.76; 'choice': 0.76; 'var': 0.81; 'thus,': 0.84; 'amended': 0.91
DKIM-Filter: OpenDKIM Filter v2.11.0 vps.rangi.cloud E09AD8323
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=danceswithmice.info;
s=staff; t=1659741335;
bh=PNr14gd8NyzP6i2JYauKJykzw91zp7CzadOJKqmHdSw=;
h=Date:Subject:To:References:From:In-Reply-To:From;
b=Vlk4G7B3H8EiGk8tqLNjkpk7NlwmEX9xLUVQXzsQbEyi6TjgM5NEZGAmu1W25y59v
KDDKlSSvyf6yozZjM9z4TiBcOF1Q3s3HLfR/iGc9sooKV7oiHFU9LDEODVdhbi2hX3
aBlQyHj1ZyWzGjwDDKfy5JAaNpUm64YHa3/UGaGiqlKM3Ezb8dEvj9btY3gMlyc2Y3
7cPMVmWQ+SEnvZHoZvExsYgrPGTBrDSUs2WAFecoGmhLom+b2cksC1BRcC0wZ6HlyL
NtVWYV41UV8F4H6YmopxienAv7ThLVi9wduHqcLe5gXl7oSKIDft9ewgHGAr6+flDx
Wp4sE+eJZiqhA==
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.11.0
Content-Language: en-GB
In-Reply-To: <CAGGBd_pHikuuYDJmVTdNrxwEeG5H3c5X_8YOmziqhTiU03SB_Q@mail.gmail.com>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <97365836-784a-f9f1-00f0-1d4420340d11@DancesWithMice.info>
X-Mailman-Original-References: <D50821A2-0B73-478B-8898-6858122D27B7@gmail.com>
<CAGGBd_pHikuuYDJmVTdNrxwEeG5H3c5X_8YOmziqhTiU03SB_Q@mail.gmail.com>
 by: dn - Fri, 5 Aug 2022 23:15 UTC

On 06/08/2022 10.50, Dan Stromberg wrote:
> On Fri, Aug 5, 2022 at 12:35 AM <ojomooluwatolami675@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

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor