raw_input

Tim Williams (gmail) tdwdotnet at gmail.com
Thu Mar 23 11:43:16 EST 2006


On 23/03/06, cm012b5105 <cm012b5105 at blueyonder.co.uk> wrote:
>
>
>
>
>
> if s = raw_input ("hello what's your name? ")
> if s=='carmel ':
> print "Ahh the boss's wife"
>
>
>
> What i would like to know is what if she doesn't write carmel she rights
> say carm short of me writing if s=='carm': on a new line is there a
> shorter way of doing this so i can cover all angles on how she might write
> her name.
> Thanks nigeps I appologise for my earlier thread
>
> if she doesn't write carmel she rights say carm


The following will accept any subset of "carmel" in upper, lower or mixed
case

EG   Carmel, carmel, Carm, mel etc

>>> if raw_input ("hello what's your name? ").lower() in 'carmel':
...     print "Ahh the boss's wife"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20060323/cd2b6df2/attachment.html>


More information about the Python-list mailing list