Q:

How to trace the input error in my hangman program?

I have an error in the input section of the code. Normally it is working well but in this code, I do not know why this is showing error.
print("Welcome to the game, Hangman!")
print("I am thinking of a word that is ",len(secretWord)," letters long.")
print("-------------")
n=8
G_new=''
k=''
while n>0 and secretWord!=G_new:
      print("You have ",n," guesses left.")
      G_old=[G_new,]
      print("Available letters: ",getAvailableLetters (G_old)
      **k=input("Please guess a letter: ")**  #error in this line
      g=k.lower()
      G_new=G_old+[g,]
      if isWordGuessed(secretWord, G_new)==True and g not in G_old:
         print("Good guess: ",getGuessedWord(secretWord, G_new))

      elif isWordGuessed(secretWord, G_new)==True and g in G_old:
           print("Oops! You've already guessed that letter: ",getGuessedWord(secretWord, G_old))

      else:
           print("Oops! That letter is not in my word: ",getGuessedWord(secretWord, G_old))
           n-=1
      print("-------------")
if n==0 and secretWord!=G_new:
   print("Sorry, you ran out of guesses. The word was ",str(secretWord),".")
elif n>=0 and secretWord==G_new:
     print("Congratulations, you won!")

A:

Count the ( and ):
  print("Available letters: ",getAvailableLetters (G_old)
       1                                          2     2    1????

As a general rule, if you get a syntax error that says "unexpected" or whatever, the error is invariably NEVER on the line in the error message - it's actually somewhere EARLIER, where you made a typo. The specified error location is merely the first place where the parser realized there IS a problem.

