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:
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
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):
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
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
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
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
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
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
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:
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())
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(),
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
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
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
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
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 =
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.
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
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
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
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
22 matches
Mail list logo