Confused about while statement
Erik Max Francis
max at alcyone.com
Thu May 20 21:40:02 EDT 2004
EAS wrote:
> 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?
You meant
while h != "hello" and h != "goodbye": ...
--
__ Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
/ \ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
\__/ She glanced at her watch ... It was 9:23.
-- James Clavell
More information about the Python-list
mailing list