[Tutor] trying to generate change in print output
Alan Gauld
alan.gauld at btinternet.com
Mon Nov 8 01:52:48 CET 2010
"Terry Green" <tmantjg at 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/
More information about the Tutor
mailing list