In Python |
is binary OR. You should use or
operator, like this
if guess == location1 or guess == location2 or guess == location3:
And this line also has to be changed
if (guess < 0 | guess > 6):
to
if guess < 0 or guess > 6:
Quoting from the Binary bit-wise operator documentation,
The
|
operator yields the bitwise (inclusive)OR
of its arguments, which must be plain or long integers. The arguments are converted to a common type.
But, normally this statement is written like this
if guess in (location1, location2, location3):
Also, raw_input
returns a string. So you need to explicitly convert that to an int
like this
guess = int(raw_input("Ready, aim, fire! (enter a number from 0-6): "))
Note that, you don't need ;
in Python to mark the end of statement.