Where is this Syntax Error Coming from?! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Where is this Syntax Error Coming from?!

I am working on a Hangman Game project and cannot further develop it as I don't know where this SyntaxError is coming from. I have been scratching my head for a little bit now trying to figure out where this is coming from. The whole piece of code is below......I have capitalized the line where I get the error message. Any help is greatly appreciated. Thank you in advance! print("This is Hangman. You have 9 tries to guess the word.\nGood luck!") word_bank = ["Eagle", "Celtic", "Bear", "Coffee", "Tea", "Table", "Dictionary", "Chair", "Interrupt", "Quick", "Speaking", "Domestic", "Market", "Export", "Partnership", "Thousand", "Region", "Representative", "School", "music", "Library", "encylopedia", "light", "pendulum", "inseparable", "animals", "China", "Rugby", "Football"] import random answer = word_bank[random.randint(0,30)] final_guess = None guesses = 0 guesses_remaining = 9 - guesses print("The word you are trying to guess is " + str(len(answer)) + " letters long. Good luck!") guess = str(input("Please guess a letter: ")) while final_guess != answer or guesses != 9: if guess.lower() in answer or guess.upper() in answer: print("That's right! The word has " + str(answer.count(guess)) + " " + str(guess) + "(s)." GUESS = INPUT(\NWHAT'S YOUR NEXT GUESS") else: guesses += 1 print("Sorry, that's wrong. You have " + guesses_remaining + " guesses remaining.") guess = input("\nYour next guess: ") if final_guess == answer: print("Print Congratulations, you did it!") elif guesses == 9: print("Sorry ") ************************************************************************************** guess= input("\nWhat's your next guess? ") ^ SyntaxError: invalid syntax

27th Sep 2019, 4:49 PM
Alex
Alex - avatar
2 Answers
0
Python is format sensitive paste it in the code playground, save then paste the link in a comment, for easier debugging.
27th Sep 2019, 5:11 PM
Manual
Manual - avatar
0
Manual (Mod) Please take a look here: https://code.sololearn.com/cRi7AUJ19I9p/#py Please note the error listed above is from an external IDE (PyCharm). The PyCharm error is what is listed above. Thanks!
14th Oct 2019, 7:36 AM
Alex
Alex - avatar