can someone tell me why this doesn't work please python 3
Steven D'Aprano
steve at REMOVE-THIS-cybersource.com.au
Wed Jan 14 18:08:12 EST 2009
On Wed, 14 Jan 2009 09:45:58 -0800, Dennis Lee Bieber wrote:
> Personally -- I'd accept anything that started with the character:
>
> while True:
> password = input(prompt).lower()
> if password.startswith("y"):
> return True
> elif password.startswith("n"):
> return False
[...]
>>> response = input("Shall I delete all your files? ").lower()
Shall I delete all your files? Ye gods, NOOO!!!!!
>>> if response.startswith('y'): print "Deleting files now"
...
Deleting files now
There are times where being flexible in what you accept is *not* a virtue.
--
Steven
More information about the Python-list
mailing list