"Rance Hall" <[email protected]> wrote


My current if statement looks like this:

if ((userentry.lower != "c" or userentry.lower != "i") and
                mode == "add"):

Peter has poinrted out one roblem but there is another.

The or expression will always be true, consider:
1) The first term will only fail if the value is 'c'
If the value is 'c; then the second trrrm will be True
and the or expression will be True
2)The 2nd term will only fail if the value is 'i'
If the value is 'i' then the first term will be True
and the or expression will be True

And since True and A is the same as A you ight as well
just write:

if mode == 'add':

Based on your code I'm not actually sure what the correct logic
should be, but I'm pretty sure its not what you have!


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


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

Reply via email to