My hangman python code seems to be stuck in an infinite loop?
<p>In my hangman code I got the length of the letters and blank spaces to match up but for some reason i cannot get the letters to replace the spaces and its an infinite loop. I have no idea where I'm going wrong / what I'm missing. </p>

<pre><code>from random import*

def main():
print
print "-----------------------------------"
print "H A N M G M A N: Tropical Fruit 1.0"
print "-----------------------------------"
print
wordList = ["pomegranate","mango","cassabanana","conkerberry","jujube"]
randomIdx = randrange(0, len(wordList))
secretWord = wordList[randomIdx]
print "(The secret word is", secretWord,")"
lettersGuessed = []
underscore = []
for i in range(len(secretWord)):
    underscore.append('_')
    newUnderscore = " ".join(underscore)
print newUnderscore
count = 6
while(True):
    guess = getNewLetter(lettersGuessed)
    if lettersGuessed == randomIdx:
        print "You guessed the letter! It is: ",ch2
        break

def getLetter():
   letter = True
   while (letter):
     ch = raw_input("Guess a letter: ")
     if len(ch) == 1:
       if ('a' &lt;= ch) and (ch &lt;= 'z'):
         return ch
       elif ('A' &lt;= ch) and (ch &lt;= 'Z'):
         return chr(ord(ch)-ord('A')+ord('a'))
       else:
         print ch,"is not a valid letter."
     else:
       print ch,"is not a single character."

def getNewLetter(oldChar):
letter = True
while (letter):
    ch = getLetter()
    if ch not in oldChar:
        oldChar.append(ch)
        return ch 
    else:
        print "You already guessed",ch,"!"


main()
</code></pre>

<p>EDIT: So i changed the while loop in the main function to this so the letter would append into blanks but still something is wrong.</p>

<pre><code>while(True):
guess = getNewLetter(lettersGuessed)
if lettersGuessed == randomIdx:
        lettersGuessed.append(newUnderscore)
        return newUnderscore
        break
</code></pre>
