"Terry Green" <tman...@gmail.com> wrote

Am stumped, when I use this code:

race=int(row[2])
   raceChek=1

   if raceChek == race: print ('raceChek ', raceChek, 'race ', race)
   else: print ('raceChek ', raceChek,' no match ', 'race ', race);
raceChek = race

I Get this:

raceChek  1 race  1
raceChek  1  no match  race  2
raceChek  1  no match  race  3

Seems my test between race and raceChek doesn't work! What is wrong?

From the segment of code you posted it loks like it works perfectly.
When race is different to 1 you get the second message when it
is equal to 1 tyou get the first.

What did you expect?

And how are you generating the repeated results?
Do you have a loop somewhere or just repeatedly run the same code?


--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to