On Oct 19, 11:59 am, Chris McComas <[EMAIL PROTECTED]> wrote: > On Oct 18, 3:46 pm, Aaron Brady <[EMAIL PROTECTED]> wrote: > > > > > Chris McComas wrote: > > > actually i'm running it online, with a mysql db. so in the db there is > > > a table CollegeYear with the following fields: > > > > name > > > rating > > > change > > > wp > > > > then another table Games > > > > date > > > year > > > team_1 > > > team_1_score > > > team_2 > > > team_2_score > > > > it goes through and calculates everything, then when it's time to > > > compute the rating i have say this code: > > > >http://dpaste.com/85300/
What is the point of this: if games.team_1_score > games.team_2_score t1_rating = t2_rating + t1_wp - .5 t2_rating = t1_rating + t2_wp - .5 elif games.team_1_score < games.team_2_score t1_rating = t2_rating + t1_wp - .5 t2_rating = t1_rating + t2_wp - .5 elif games.team_1_score == games.team_2_score t1_rating = t2_rating + t1_wp - .5 t2_rating = t1_rating + t2_wp - .5 You have the same code for each of the three conditions. Where are the colons? Have you actually tried to execute this code? Any good reason why the second elif is not an else? > > > > it goes through and computes them, then add the new rating and > > > absolute value of the changed rating to the db. what i need now is a > > > way to get the largest entry for 'change' and if it is greater than > > > 0.00005 then do this code again. if it is less than 0.00005 then we're > > > done. > > > What about "SELECT MAX( rating ) FROM CollegeYear"? > > Aaron, > > Thnx. To clarify I can get the max, that wasn't the issue, what I'm > failing to try and visualise/figure out is how do I say, okay if MAX > > 0.00005 run this again, if MAX < 0.00005 you're done. [Aside: if MAX == 0.00005, what? Go into a catatonic trance?] Let me get this straight: Is this your first program? Are you asking how to code a while loop? -- http://mail.python.org/mailman/listinfo/python-list