Re: [Tutor] break and exit

2014-11-21 Thread Peter Otten
James Rieve wrote: I accidently used 'exit' in a loop where I meant to use 'break' and, in that case, the program seemed to work as expected but in some cases 'exit' seems to behave differently from 'break'. For example, in this code snippet using 'exit' or 'break' produces the same result:

Re: [Tutor] break and exit

2014-11-21 Thread Alan Gauld
On 21/11/14 04:10, James Rieve wrote: I accidently used 'exit' in a loop where I meant to use 'break' and, in that case, the program seemed to work as expected but in some cases 'exit' seems to behave differently from 'break'. For example, in this code snippet using 'exit' or 'break' produces

[Tutor] break and exit

2014-11-20 Thread James Rieve
I accidently used 'exit' in a loop where I meant to use 'break' and, in that case, the program seemed to work as expected but in some cases 'exit' seems to behave differently from 'break'. For example, in this code snippet using 'exit' or 'break' produces the same result: for i in range(10):

[Tutor] Break outside the loop error (line 23)

2014-05-31 Thread Sasi -
Hi, i tried to make a code to execute the functions that i described below. However i got a break outside the loop error and i have tried to tab and all that but i still get the same error for line 23. I'm using python 2.7 Please help me. I'm completely new to coding (just started last

Re: [Tutor] Break outside the loop error (line 23)

2014-05-31 Thread Wolfgang Maier
On 31.05.2014 11:23, Sasi - wrote: Hi, i tried to make a code to execute the functions that i described below. However i got a break outside the loop error and i have tried to tab and all that but i still get the same error for line 23. I'm using python 2.7 Hi, as a general rule, copy paste

Re: [Tutor] Break outside the loop error (line 23)

2014-05-31 Thread Alan Gauld
On 31/05/14 10:23, Sasi - wrote: Hi, i tried to make a code to execute the functions that i described below. However i got a break outside the loop error Always post the full error message it usually contains lots of useful detail. ## Created the lists for brain and plasma before searching

[Tutor] break

2013-03-14 Thread Matthew Ngaha
i cant seem to break out of this loop. let me explain the variables you see: Enemy.ships = [] #an Enemy class variable that contains enemy ships self.missiles = [] an instance variable that appends how many Visible missiles my ship has fired Enemy.rects = [] an Enemy class variable that

Re: [Tutor] break

2013-03-14 Thread Mitya Sirenef
On 03/14/2013 06:38 PM, Matthew Ngaha wrote: i cant seem to break out of this loop. let me explain the variables you see: Enemy.ships = [] #an Enemy class variable that contains enemy ships self.missiles = [] an instance variable that appends how many Visible missiles my ship has fired

Re: [Tutor] break

2013-03-14 Thread Dave Angel
On 03/14/2013 06:38 PM, Matthew Ngaha wrote: i cant seem to break out of this loop. let me explain the variables you see: SNIP if Enemy.ships: for missile in self.missiles: flag = False for rect in

Re: [Tutor] break

2013-03-14 Thread Matthew Ngaha
if Enemy.ships: for missile in self.missiles: flag = False for rect in Enemy.rects: assert(!flag) if QPoint(missile.x + 5, missile.y) in rect:

Re: [Tutor] break

2013-03-14 Thread Matthew Ngaha
One good approach is to have a separate function or method with both loops: def attack(self, Enemy): for missile in self.missiles: for rect in Enemy.rects: if QPoint(missile.x + 5, missile.y) in rect: explosion = Explosion(rect.x(), rect.y())

Re: [Tutor] break

2013-03-14 Thread Mitya Sirenef
On 03/14/2013 08:08 PM, Matthew Ngaha wrote: One good approach is to have a separate function or method with both loops: def attack(self, Enemy): for missile in self.missiles: for rect in Enemy.rects: if QPoint(missile.x + 5, missile.y) in rect: explosion = Explosion(rect.x(),

Re: [Tutor] break

2013-03-14 Thread Matthew Ngaha
thanks guys ive finally got it working. even though i didnt use the flag due to invalid syntax i realized since i was getting no errors i wasnt actually doing anything wrong. My mistake was i removed the ememy ship but for some reason forgot to remove the missile so it was still active on the next

Re: [Tutor] break

2013-03-14 Thread Mitya Sirenef
On 03/14/2013 08:45 PM, Matthew Ngaha wrote: thanks guys ive finally got it working. even though i didnt use the flag due to invalid syntax i realized since i was getting no errors i wasnt actually doing anything wrong. My mistake was i removed the ememy ship but for some reason forgot to remove

Re: [Tutor] break

2013-03-14 Thread Dave Angel
On 03/14/2013 07:23 PM, Matthew Ngaha wrote: if Enemy.ships: for missile in self.missiles: flag = False for rect in Enemy.rects: assert(!flag) if

[Tutor] Break Help

2012-05-29 Thread PhantomsCore
if gameIsDone: if playAgain(): missedLetters = '' correctLetters = '' gameIsDone = False secretWord = getRandomWord(words) else: break That is my coding. When I try to run it I get Break outside loop -- View

Re: [Tutor] Break Help

2012-05-29 Thread Corey Richardson
On Tue, 29 May 2012 17:50:37 -0700 (PDT) PhantomsCore thomas...@wsdstudent.net thomas...@wsdstudent.net wrote: if gameIsDone: if playAgain(): missedLetters = '' correctLetters = '' gameIsDone = False secretWord =

Re: [Tutor] Break stament issue

2011-06-17 Thread Steven D'Aprano
Susana Iraiis Delgado Rodriguez wrote: Hello members!! Steven, I already changed the settings in the IDE to avoid the trouble when I type the code. In the other hand I added the pass statement so the script keep working even though it finds an error, but the scripts ignore the pass statement.

Re: [Tutor] Break stament issue

2011-06-15 Thread Susana Iraiis Delgado Rodriguez
Hello members!! Steven, I already changed the settings in the IDE to avoid the trouble when I type the code. In the other hand I added the pass statement so the script keep working even though it finds an error, but the scripts ignore the pass statement. Console prints: Traceback (most recent

[Tutor] Break stament issue

2011-06-14 Thread Susana Iraiis Delgado Rodriguez
Hello members! I'm doing a script that needs to loop to get some information, in order to do that I'm using modules from OGR and Mapnik. These to get data from shapefiles, but some of the files have 0 elements, I wrote a line to validate it, but it hasn't worked, so I added a break to keep

Re: [Tutor] Break stament issue

2011-06-14 Thread James Reynolds
On Tue, Jun 14, 2011 at 2:59 PM, Susana Iraiis Delgado Rodriguez susana.delgad...@utzmg.edu.mx wrote: Hello members! I'm doing a script that needs to loop to get some information, in order to do that I'm using modules from OGR and Mapnik. These to get data from shapefiles, but some of the

Re: [Tutor] Break stament issue

2011-06-14 Thread Steven D'Aprano
Susana Iraiis Delgado Rodriguez wrote: Hello members! I'm doing a script that needs to loop to get some information, in order to do that I'm using modules from OGR and Mapnik. These to get data from shapefiles, but some of the files have 0 elements, I wrote a line to validate it, but it hasn't