Nested while-s
Harald Hanche-Olsen
hanche at math.ntnu.no
Sat Jan 15 00:35:48 EST 2000
More information about the Python-list mailing list
Sat Jan 15 00:35:48 EST 2000
- Previous message (by thread): Tcl/Tk Path problems in Python 1.5.2 installation
- Next message (by thread): Nested while-s
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
+ josht at iname.com (Josh Tompkins): | Is it not possible to nest while's? It sure is. | Consider this code: | | def listOfRadius(radius, xpos, ypos): | list = [] | currentX = (xpos - radius) | currentY = (ypos - radius) | while currentX <= (xpos + radius): | while currentY <= (ypos + radius): | str1 = `currentX` + " , " + `currentY` | list.append(str1) | currentY = currentY + 1 | currentX = currentX + 1 | return list | | It will list only the values from the nested while. Move the initialization of currentY into the top of the outer while loop. -- * Harald Hanche-Olsen <URL:http://www.math.ntnu.no/~hanche/> - "There arises from a bad and unapt formation of words a wonderful obstruction to the mind." - Francis Bacon
- Previous message (by thread): Tcl/Tk Path problems in Python 1.5.2 installation
- Next message (by thread): Nested while-s
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list