Confused about while statement

EAS eriksp at attbi.nospam.com
Thu May 20 21:11:37 EDT 2004


In theory, the following code should ask for the user to enter a value for h
until he/she enters hello or goodbye.

h = "hi"
while h != "hello" or "goodbye":
        h = raw_input("Value for h:")

But the program keeps asking for a value no matter what I enter. Why doesn't
it work?





More information about the Python-list mailing list