lower
is a function in python.
Be sure to include the elipses ()
. It should look like string.lower()
Also, try putting it at the end of your input so you don't have to type it every time
replay = raw_input('Play again? ').lower()
As Jon Clements pointed out, something that I looked over and missed in your code, consider the following statement:
if replay.lower() == "yes" or "y":
#execute
To the human eye, this looks correct, but to the computer it sees:
if replay.lower() is equal to "yes" or if 'y' is True...execute
Your game will always replay because "y" is a string and always true. You must replace the code with something like this (my above advice included):
if replay == 'yes' or replay == 'y':
#execute
finally, import sys
at the top of your program. This is where the error is occurring, because sys
is a module that must be imported to the program.
Here is an article on operators that you might benefit reading from