"Steven D'Aprano" wrote
I don't think you want to break out of *any* of the loops. Otherwise
you will skip testing combinations.
In that case I misread the OP. I thought he specifically wanted
to avoid testing all the options and exit when he reached his target.
In your example, the first t
Alan Gauld wrote:
"Wayne Werner" wrote
You probably want to add a sentinel to break out of the outer
loops too:
I don't think you want to break out of *any* of the loops. Otherwise you
will skip testing combinations. In your example, the first time you set
highscore and alignment, you break
Alan Gauld wrote:-
> "Wayne Werner" wrote
> found = False
> > highscore = 0
> > alignment = somealignment
> > for x in something and not found:
> > for y in somethingelse and not found:
> > for z in evenmoresomething:
> > if x+y+z > highscore:
> > hi
"Wayne Werner" wrote
You probably want to add a sentinel to break out of the outer
loops too:
found = False
highscore = 0
alignment = somealignment
for x in something and not found:
for y in somethingelse and not found:
for z in evenmoresomething:
if x+y+z > hig
On 02/07/2011 10:33 AM, Ashley F wrote:
I am trying to write a function...(it's kind of like a long way to do
BLAST but only comparing 2 sequences)
I have 3 loops nested...Within those loops, I obtain a "best fit
score" so to speak.
I can get the program to run...but the loops run all the way to
On Mon, 7 Feb 2011, Ashley F wrote:
To try to clear this up...
The part of my pseudocode that I'm having trouble putting into actual code in
python is:
"if that alignment has the best score seen so far
save the score and that alignment"
Tip: It's helpful to send code, like perhaps the
On Mon, 22 Aug 2005, Kent Johnson wrote:
> > Is there any way more efficient for run a nested loop?
> >
> > --
> > for a in list_a:
> > for b in list_b:
> > if a == b: break
Hi Jonas,
Depends on what we're trying to do. Is it necessary to have a nested loop
here? What kind of
> Is there any way more efficient for run a nested loop?
>
> --
> for a in list_a:
if a in list_b:
break
Should help a bit,
Alan G.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Jonas Melian wrote:
> Is there any way more efficient for run a nested loop?
>
> --
> for a in list_a:
> for b in list_b:
> if a == b: break
efficient in running time? lines of code? What you have is pretty simple, what
don't you like about it?
In Python 2.4 you could use a gene