Issue 13206: while loop vs for loop test (original) (raw)

Created on 2011-10-18 06:31 by JavaJunkie, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
LOOP_Test1.py JavaJunkie,2011-10-18 06:31 Simple loop test with "while" and "for" while does not work as expected
Messages (4)
msg145775 - (view) Author: R Blackmore (JavaJunkie) Date: 2011-10-18 06:31
Using Python 3.2.2 on Windows 7 See attached file Was having problem with a program I was doing... couldn't get around issue unless I changed from "while" loop to "for" loop... WTF??? So restarted computer and then Python Shell and IDLE I wrote a very simple loop file... The 1st loop is a while loop that hangs and only prints divisor 1 and divisor 2 (Should also print divisor 5) For loop works as expected printing divisor 1 divisor 2 divisor 3 Unless I'm missing something both loops should return (i.e. print) same! Cheers
msg145776 - (view) Author: R Blackmore (JavaJunkie) Date: 2011-10-18 06:36
for loop works correctly prints divisor 1 divisor 2 divisor 5 (original post incorrectly listed divisor 3,)
msg145777 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2011-10-18 07:13
Your 'i = i + 1' is at the wrong indentation level.
msg145779 - (view) Author: R Blackmore (JavaJunkie) Date: 2011-10-18 08:17
I knew it was late... Should have slept on it Thanks --- On Tue, 10/18/11, Mark Dickinson <report@bugs.python.org> wrote: > From: Mark Dickinson <report@bugs.python.org> > Subject: [] while loop vs for loop test > To: squank77@yahoo.com > Date: Tuesday, October 18, 2011, 12:13 AM > > Mark Dickinson <dickinsm@gmail.com> > added the comment: > > Your 'i = i + 1' is at the wrong indentation level. > > ---------- > nosy: +mark.dickinson > resolution:  -> invalid > status: open -> closed > > _______________________________________ > Python tracker <report@bugs.python.org> > <http://bugs.python.org/issue13206> > _______________________________________ >
History
Date User Action Args
2022-04-11 14:57:22 admin set github: 57415
2011-10-18 08:17:58 JavaJunkie set messages: +
2011-10-18 07:13:32 mark.dickinson set status: open -> closednosy: + mark.dickinsonmessages: + resolution: not a bug
2011-10-18 06:36:25 JavaJunkie set messages: +
2011-10-18 06:31:13 JavaJunkie create