On 15/03/13 23:37, Christopher Emery wrote:
so I may understand the why to your statement "

> WHy the unneeded parenthesis?

Mark was pointing out that parentheses are not needed in a while statement. So why add them? They just add visual clutter.

What about 'yes'?"

And here he was alluding to the fact that your code requires a capitalised 'Yes', but in practice it should be OK to enter
lower case, or even all caps, input too.

ie.
yes
Yes
YES

should all be valid

and yES, yeS and yEs won't be too bad either.

The solution is usually to convert input to all
lower (or upper) before checking its value.

answer = input(question).lower()

Now we can test for 'yes' regardless of what combination
of case the user actually typed.

HTH,
--
Alan G
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