Thorsten Kampe thorsten at thorstenkampe.de
Sat Sep 11 16:10:09 CEST 2004

* Thorsten Kampe (2004-09-11 15:56 +0200)
> * TuPLaD (2004-09-11 14:34 +0200)
>> if user type: n, no, nop, nope then print 'You canceled'
>> else
>> if user type: y, ye, yes, yep then print 'We are beginning'
>> How do i do that ?
> There's a tutor list where people who are constanty bored just wait
> for questions like this.
> Excerpt from a template.py of mine:

In fact my script is a bit stricter than your question: it doesn't
allow 'yep' or 'nononono'. Some utilities allow that (probably with a
reason) and even non localised answers (for instance in German 'j',
'ja' (pronounced 'yaa') would be valid answers, but also 'y', 'ye' and
'yes' are allowed).

If you want that you would only have to ask whether the answer starts
with the same letter as your valid answer.


More information about the Python-list mailing list