statement expected error please help

i have just got pycharm 2 days ago so i am a beginner,

in my script there is a error that says, statement expected, found by ELIF_KEYWORD.

here is the line elif command == "word":

Play = input("Would you like to play (Yes/No)? ").upper()
print(" ")
secret_word = "word"
secret_number = 7
guess_count = 0
guess_limit = 6

if Play.upper() == "NO":
print("See you later ")
quit()
if Play.upper() == "YES":
command = input("Word or Number? ")
if command.upper() == "NUMBER":
print("""welcome
to my guessing game you have six tries
to either guess the number or word good luck""")

while guess_count < guess_limit:
guess = int(input("guess:"))
guess_count += 1
if guess != secret_number and guess_count < guess_limit:
print(" ")
print("try again")
print(" ")
if guess == secret_number:
print("You won!")
break
else:
print("sorry you lose...")
quit()

elif command = "WORD"
guess = str(input("guess:"))
guess_count += 1
if guess != secret_word and guess_count < guess_limit:
print(" ")
print("try again")
print(" ")
if guess == secret_word:
print("You won!")
quit()

else:
print("you lose")

 

1 comment
Comment actions Permalink

I'm not sure, but you probably meant something like this:

Play = input("Would you like to play (Yes/No)? ").upper()
print(" ")
secret_word = "word"
secret_number = 7
guess_count = 0
guess_limit = 6

if Play.upper() == "NO":
print("See you later ")
quit()

if Play.upper() == "YES":
command = input("Word or Number? ")
if command.upper() == "NUMBER":
print("""welcome to my guessing game you have six tries to either guess the number or word good luck""")

while guess_count < guess_limit:
guess = int(input("guess:"))
guess_count += 1
if guess != secret_number and guess_count < guess_limit:
print(" ")
print("try again")
print(" ")
elif guess == secret_number:
print("You won!")
break
else:
print("sorry you lose...")
quit()

elif command.upper() == "WORD":
while guess_count < guess_limit:
guess = str(input("guess:"))
guess_count += 1
if guess != secret_word and guess_count < guess_limit:
print(" ")
print("try again")
print(" ")
elif guess == secret_word:
print("You won!")
quit()
else:
print("you lose")
0

Please sign in to leave a comment.