[Tutor] nested loops
Wayne Werner
waynejwerner at gmail.com
Mon Feb 7 16:55:18 CET 2011
On Mon, 7 Feb 2011, Ashley F wrote:
> <snip>
> 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 triple loop, that
illustrates your problem.
highscore = 0
alignment = somealignment
for x in something:
for y in somethingelse:
for z in evenmoresomething:
if x+y+z > highscore:
highscore = x+y+z
alignment = newalignment
Is that something to the effect of what you're looking for?
HTH,
Wayne
More information about the Tutor
mailing list