How do I modify this program player has 5 chances to ask a letter is in the word. Computer responds yes and no.
Original Exercise - Computer picks a random word from a list and player guesses the word. Computer tells the player how many letters are in the word. Then the player gets 5 chances to ask whether letter is in the word. Computer responds yes and no after the 5 chances player must guess the word. Unfortunately I screwed up I got the random part and how many letters in the word. I am able to check the letters in the words higher or lower value,but how do I do it in a way that computer will check and respond back yes and no whether the letter is in the word plus I have to do it 5 tries before player must guess the word.

import random

# list of words
words = ['python', 'jumble', 'easy', "difficult", "answer", "tracer", "muffin"]



# Computer picks one word from the list

word = random.choice(words)
# create a variable to use later to see if the guess is correct
correct = word

print "Guess the word hint there are :", len(word)
print "letters"
guess = raw_input("\nYour guess:")
guess = guess.lower()
while (guess !=correct) and (guess !=""):
      if guess > word:
         print "Lower letter.."
      elif guess < word:
         print "Higher letter.."
      else:
         print "You guessed it correctly"
      guess = raw_input("\nYour guess:")
      guess = guess.lower()

if guess == correct:
    print "That's it! You guessed it!\n"
    
print "Thanks for playing."

raw_input("\n\nPress the enter key to exit.")

This program appears to be a merge of the 'have the computer pick a word and have the user guess it' and your 'number guessing' program.

As written, the user doesn't have any interface to ask if the word contains a letter. You let them guess at the word and tell them if the word is what they guessed, or if it comes alphabetically before or after their guess.

The message 'Lower Letter' which means the computer's word would appear before the word the player guessed in the dictionary and the message 'Higher Letter' which means the computer's word would appear after the word the player guessed are not very intuitive.

Before you go writing a bunch of code, plan how you think the user might interact with a program that worked like what you describe.

How does the user specifiy they are guessing a letter or if they are guessing the word?

How does the program tell them whether or not the letter is in the word?

How does the program tell them how many more letter guesses the player has?

Can the player make more than one guess at the word?

Does the game play more than once, or does it quit and the user has to re-start it to play again?

If you better define how the user will interact (which in turn describes how your program must behave) you'll have a much better idea of where to go next with the program.

See the last post here for the general idea http://www.daniweb.com/forums/thread158680.html You want to use some variable in a while loop that you can set to false if (1) the correct word is guessed, (2) the maximum number of guesses is reached, (3) any other exit criteria. You can also use a function and return on any of the above.

Darn it I now get this error message -
line 17, in -toplevel-
guess +=tried_bad
TypeError: cannot concatenate 'str' and 'tuple' objects

# Guess My Word
# Players pick letters in a random secret word
# Eli Zabielski-2/13/06
import random
print "Hello, I will give you 5 chances to guess letters of one of my secret words.\n On the final chance, you must guess the word"
WORDS = ("python", "jumble", "difficult", "answer", "xylophone",
         "recon", "recordable")
word=random.choice(WORDS)
print "The word is", len(word), "letters long."

guess= (raw_input("Take a guess  "))
tried_good=()
tried_bad=()
guess_count=0
while guess not in word:
    guess_count+=1
    guess +=tried_bad
    print "Nope, try again\n"
    print "Bad tries",tried_bad    
    guess=input("\nguess one letter")
    if guess_count==4:
        "You have to guess the word now"
        guess_word=input("What say you")
        guess_word=guess_word.lower()
while guess in word:
    print "Good, you got one"
    guess+=tried_good
    print "Bad tries",tried_bad
    print "Good tries", tried_good
    guess=input("\nguess one letter")
    if guess_count==4:
        "You have to guess the word now"
        guess_word=input("What say you")
        guess_word=guess_word.lower()
if guess_word==word:
    print "Good, you got it!"
elif guess_word != word:
    print "Aww, thats too bad, the word is mine forever"
exit=input("Press enter to exit.")

You entered tried_good = ( ) did you mean tried_good = 0 ?

Repeat above comment for tried_bad as well.

You have 2 while loops with neither while really meeting your goal. I think you'd be better off with a for loop, prompting for letter guesses. Then use an if to display whether or not the letter guess was in the word.

When the for loop runs out, they have used all of their letter guesses and will have to guess at the word.

for guesscount in range(1,6):
        lguess = raw_input("Enter your letter guess #%d" % guesscount)
        # put an if test here along with the 'yes' or 'no' display
    # They've run out of letter guesses
    guess_word = raw_input("What do you think the word is? ")
    # test and output here

If you're using a tuple to keep track of what the user has already tried then you'll need to concatenate in the following manner:

>>> a = ()
>>> a += 'a'
Traceback (most recent call last):
  File "<input>", line 1, in <module>
TypeError: can only concatenate tuple (not "str") to tuple
>>> a += ( 'a', )
>>> a
('a',)

Perhaps you'd be better off using a list so that you can do this:

>>> b = []
>>> b.append( 'a' )
>>> b
['a']
>>>

HTH

Unfortunately the list feature is in the next chapter. Suppose to just use loops, strings and tuples.

Two examples of appeding to tuples:

>>> my_tup = ()
>>> my_tup2 = ()
>>> for i in xrange( 5 ):
...     my_tup += ( 'Entry %d' % i, )
...     my_tup2 += tuple( str( i ) )
...     
>>> my_tup
('Entry 0', 'Entry 1', 'Entry 2', 'Entry 3', 'Entry 4')
>>> my_tup2
('0', '1', '2', '3', '4')
>>>

Am I interpreting this correctly -
So using the example for the program above
my_tup = () - would be tried_good = ()
my_tup2=() - would be tried_bad = ()
for i in range in xrange (5): meaning I will have 5 chances.
my_tup += ( 'Entry%d' % i, ) Would the entry be the words or the letters in all the words?
my_tup2 += tuple(str(i)) what is the 2nd tuple?

Sorry for asking dumb question examples in the book are confusing.

Here's the original program -

# Guess My Word
# Players pick letters in a random secret word
import random
print "Hello, I will give you 5 chances to guess letters of one of my secret words.\n On the final chance, you must guess the word"
WORDS = ("python", "jumble", "difficult", "answer", "xylophone", "recon", "recordable")

word=random.choice(WORDS)
print "The word is", len(word), "letters long."

guess= (raw_input("Take a guess "))
tried_good=0
tried_bad=0
guess_count=0

 
while guess not in word:
   guess_count+=1
   guess += tried_bad
   print "Nope, try again\n"
   print "Bad tries",tried_bad
   guess=input("\nguess one letter")
   if guess_count==4:
      "You have to guess the word now"
      guess_word=input("What say you")
 
      guess_word=guess_word.lower()
  
while guess in word:
  
      print "Good, you got one"
  
      guess+=tried_good
  
      print "Bad tries",tried_bad
  
      print "Good tries", tried_good
  
      guess=input("\nguess one letter")
  
      if guess_count==4:
  
        print "You have to guess the word now"
  
      guess_word=input("What say you")
  
      guess_word=guess_word.lower()
  
if guess_word==word:
  
      print "Good, you got it!"
  
elif guess_word != word:
  
      print "Aww, thats too bad, the word is mine forever"
  
exit=input("Press enter to exit.")

I think jlm699's code was just an example of how you might extend tuples (because you said you couldn't use lists.) I don't think it was intended to be a specific example for your program.

Did you read my previous message about how I thought you ought to structure the main part of your program?

for guesscount in range(1,6):
        lguess = raw_input("Enter your letter guess #%d" % guesscount)
        # put an if test here along with the 'yes' or 'no' display
    # They've run out of letter guesses
    guess_word = raw_input("What do you think the word is? ")
    # test and output here

You don't have to follow my advice specifically, but the current structure you have will not work. The two consecutive while loops don't perform like the game should. Once you get a letter right, there is no way to get back to the loop for getting a letter wrong.

You need some form of outside loop, and the while loops really should be IF statements.

New topic:

Are you even trying to run your code? What errors are you seeing?

(I get an error after my first guess...what do you see?)

#hint you need to initialize tried_good and tried_bad as tuples
tried_good = ()
tried_bad = ()
# I know I told you to make them 0 before, but I thought you were
# counting guesses, not collecting them
#
#Then you need to do something like what jlm699 showed you
tried_bad += tuple(guess)
#where you have
guess += tried_bad

The next error is that you use input to get string data. You MUST use raw_input to get string data, and it it generally good form to always use it and validate your input before attempting to convert it to a number. (This needs to be applied in several places, including the 'Press enter to exit' line)

Try at least some of the above and re-post what you have, along with what specific problems you're seeing and we can go from there.

You don't have to use a tuple to store the guesses. A list is normally used, but you can also use a string thusly (this is not meant to be a complete solution)

guess_word = "alfalfa"
correct_guess = ""
wrong_guess = ""
previous_guesses = ""
                                                                              
## generate a list to test with instead of input
tries = [ "a", "b", "e", "a", "o" ]
for guess in tries:
   if guess in previous_guesses:
      print guess, "has already been guessed"
   elif guess in guess_word:
      print guess, "is correct"
      correct_guess += guess
   else:
      print guess, "is NOT correct"
      wrong_guess += guess
   previous_guesses += guess

Also, I prefer to use a function, and return at a breakpoint. Perhaps that will be easier to get your head around.

def guess_word(random_word):

   guess_count = 0
   correct_guess = ""
   wrong_guess = ""
   previous = ""

   while guess_count < 6: 
      guess_count+=1
      guess=raw_input("\nguess one letter ")

      if guess in previous:
         print guess, "has already been guessed"
         guess_count -= 1         ## don't charge for duplicate guesses
      elif guess in random_word:
         print guess, "is correct"
         correct_guess += guess
      else:
         print guess, "is NOT correct"
         wrong_guess += guess
      previous += guess
      ##---   while testing, check that this works correctly
      print correct_guess
      print wrong_guess

   print len(correct_guess), "correct guesses and", len(wrong_guess), "incorrect"        

   ##---  This is the return part                               
   while 1:
      print  "You have to guess the word now"
      guess_word=raw_input("What say you (hit Enter to quit) ")
      guess_word = guess_word.strip()
      if len(guess_word) == 0:   ##  Enter key only
         return
      elif guess_word.lower() == random_word:
         print guess_word, "is correct"
         return
      else:
         print "incorrect...try again"
         
random_word = "alfalfa"
ret = guess_word(random_word)    ## doesn't actually return anything
print "Thanks for playing"
Comments
I like your solution, I was just hoping to encourage the OP to do more

Tinkered with code using previous advice got this error message
'return' outside function line 35.
What does that mean?
Checked line 35
elif guess_word.lower() == random_word:
line 34 which has the return function.
So I then lined up the return function and it then complain expects an indented block. So I got that part right needs to be indented.

guess_word = ['python', 'jumble', 'easy', 'difficult', 'answer', 'tracer', 'muffin']

guess_count = 0
correct_guess = ""
wrong_guess = ""
previous = ""

while guess_count < 5: 
      guess_count+=1
      guess=raw_input("\nguess one letter ")

      if guess in previous:
         print guess, "has already been guessed"
         guess_count -= 1         ## don't charge for duplicate guesses
      elif guess in random_word:
         print guess, "is correct"
         correct_guess += guess
      else:
         print guess, "is NOT correct"
         wrong_guess += guess
      previous += guess
      ##---   while testing, check that this works correctly
      print correct_guess
      print wrong_guess

print len(correct_guess), "correct guesses and", len(wrong_guess), "incorrect"        

    ##---  This is the return part                               
while 1:
      print  "You have to guess the word now"
      guess_word=raw_input("What say you (hit Enter to quit) ")
      guess_word = guess_word.strip()
      if len(guess_word) == 0: ##Enter key only
        return
      elif guess_word.lower() == random_word:
         print guess_word, "is correct"
         return
      else:
         print "incorrect...try again"

return' outside function line 35.
What does that mean?

You have a "return" statement outside the confines of a function. Which is correct. There is no function definition in your program, and you can't do a function return from no function.

Change the return on line 34 and on line 37 to break to allow the while loop started on line 29 to exit.

Thanks it got rid of that error message reran the program now it's complaining about the 2nd break statement - That's an invalid statement. So I took it out later to see what will happened.
Outputted - guess one letter- I inputted a
returns a is not correct
a
0 correct guesses and 1 incorrect.
You have to guess the word now - It skipped the loop supposed to give me 4 more chances.
I guessed the word anyway - Outputted this error msg
guess_word = guess_word.strip()
AttributeError: 'list' object has no attribute 'strip'

guess_word = ['python', 'jumble', 'easy', 'difficult', 'answer', 'tracer', 'muffin']
guess_count = 0
  
correct_guess = ""
   
wrong_guess = ""
   
previous = ""

while guess_count < 5:
  
      guess_count+=1
  
      guess=raw_input("\nguess one letter ")
  
       
  
      if guess in previous:
         print guess, "has already been guessed"
         guess_count -= 1 ## don't charge for duplicate guesses
  
      elif guess in random_word:
         print guess, "is correct"
  
         correct_guess += guess
 
      else:
          print guess, "is NOT correct"
          wrong_guess += guess
  
      previous += guess
  
      ##--- while testing, check that this works correctly
  
      print correct_guess
      print wrong_guess
  
  
      print len(correct_guess), "correct guesses and", len(wrong_guess), "incorrect"
  
       
  
      ##--- This is the return part
  
      while 1:
  
         print "You have to guess the word now"
  
         guess_word=raw_input("What say you (hit Enter to quit) ")
  
         guess_word = guess_word.strip()
  
         if len(guess_word) == 0: ##Enter key only
    
            break
  
         elif guess_word.lower() == random_word:
  
          print guess_word, "is correct"
  
             break
  
      else:

        print "incorrect...try again"

The while loop starting on line 45 is NOT supposed to be inside the while loop from line 10. Move it out to the same level as the while from line 10.

You can not run the posted code...the posted code doesn't select or define random_word before the test on line 22. When I run it, it stops there.

When I've fixed both of the above, I'm not seeing the error you describe. What did you enter for the guess?

Ok did both of those items. Replaced random_word with word.
I entered 5 guesses all were incorrect. Something has gone awry I can't any correct letters.
Took out guess_word.strip and replaced with word.

import random

guess_word = ['python', 'jumble', 'easy', 'difficult', 'answer', 'tracer', 'muffin']
guess_count = 0
correct_guess = ""
wrong_guess = ""
previous = ""

while guess_count < 5:
  
      guess_count+=1
  
      guess=raw_input("\nguess one letter ")
  
      if guess in previous:
         print guess, "has already been guessed"
         guess_count -= 1 ## don't charge for duplicate guesses
  
      elif guess in guess_word:
         print guess, "is correct"
  
         correct_guess += guess
 
      else:
          print guess, "is NOT correct"
          wrong_guess += guess
  
      previous += guess
  
      ##--- while testing, check that this works correctly
  
      print correct_guess
      print wrong_guess
    
      print len(correct_guess), "correct guesses and", len(wrong_guess), "incorrect"
   
  
      ##--- This is the return part
  
while 1:
  
         print "You have to guess the word now"
  
         word=raw_input("What say you (hit Enter to quit) ")
  
         guess_word = word
  
         if len(guess_word) == 0: ##Enter key only
    
            break
  
         elif guess_word.lower() == word:
  
          print guess_word, "is correct"
                
else:

        print "incorrect...try again"

The problem wasn't to remove references to random_word but to set it to a random selection from your list of words.

You use guess_word in many places to mean many different things, this is generally 'bad form'.

Initially, it is the array of words:

guess_word = ['python', 'jumble', 'easy', 'difficult', 'answer', 'tracer', 'muffin']

Then later you assign it from the word that the player entered

word=raw_input("What say you (hit Enter to quit) ")
guess_word = word

So, to help me out:

Use word_list to refer to the list of words to pick from.

Set random_word to be one of the words from the word_list. (Try using random.choice)

Oh, and in a previous version, you told them how many letters were in the random word, if it is permissable still, do something like

print "My secret word has", len(random_word), "letters"

For testing / debugging, I usually add something so I can see the word. (Remove it before you turn it in or give it to someone else to play.)

print "** DEBUG: Word:", random_word, "**"

When you're validating letter guesses, see if they are in the random_word.

After the 5 guesses, have the user enter the guess_word you should strip() and lower() the guess.

Then compare the guess_word to the random_word to see if they guessed correctly.

Ok here's a partial list program not complete. Doing it in small portions - Does this one make more sense.

import random
# list of words
word_list = ['python', 'jumble', 'easy', 'difficult', 'answer', 'tracer', 'muffin']
print "My secret word has", leg(word_list). "letters"
random_word = random.choice(word_list)
guess_count = 0
correct_guess = ""
wrong_guess = ""
previous

Close, but the line 4 needs to follow like 5 and print the len of the random_word.

As written, line 4 (if it used 'len' instead of 'leg') would tell you how many words there were.

print "I'm picking one of my", len(word_list), "words."
random_word = random.choice(word_list)
print "My secret word has", len(random_word), "letters."

Ok got that resolved. Program still not complete verifying the letter input process works unfortunately when I run it it's complaining
Error: Inconsistent indentation detected!
This means that either:
1) your indentation is outright incorrct (easy to fix), or
2) Your indentation mixes tabs and spaces in a way that depends on how many spaces a tab is worth.
To fix case 2, change all tabs top spaces by using Select All followed by Untabify Region (both in the Edit menu).
Already did case 2 nothing got resolved. Indented and unindented some of the lines still couldn't resolve it. I wish it would tell me which particular line or lines that's causing the problem.

import random
# list of words the computer will be picking
 word_list = ['python', 'jumble', 'easy', 'difficult', 'answer', 'tracer', 'muffin']

 print "I'm picking one of the " , len(word_list), "words from a secret list"
 random_word = random.choice(word_list)
 print "Computer has selected secret word", len(random_word), "letters."

 guess_count = 0
 correct_guess = ""
 wrong_guess = ""
 previous = ""

 while guess_count < 5:
    guess_count+=1
    guess=raw_input("\nguess one letter ")

 if guess in previous:
    print guess, "has already been guessed ")
    guess_count -= 1 

 elif guess in random_word:
    print guess, "is correct"
      correct_guess += guess

 else:
    print guess, "is not correct"
      wrong_guess += guess

 previous += guess

    print correct_guess
    print wrong_guess

ok, you are aware the indentation is CRITICAL in python applications?

In this first case, only one line is executed 10 times and the output is 11 lines long:

for ii in xrange(10):
    print "Apple"
print "Pear"

In this second case, two lines are executed 10 times and the output is 20 lines long, the only difference is whitespace at the start of a line:

for ii in xrange(10):
    print "Apple"
    print "Pear"

I picked up the code from your message and saved it into foo.py
I ran python foo.py and got the following message:

File "foo.py", line 3
    word_list = ['python', 'jumble', 'easy', 'difficult', 'answer', 'tracer', 'muffin']
    ^
IndentationError: unexpected indent

Note that it says the problem is on line 3 and is pointing at the w in word_list. Somehow, you have added a leading space to all of the lines in your code except the import and the first comment.

Take out the leading spaces for top-level lines.

You also have blatant indentation problems with the lines numbered 25 and 29 in your last post. They need to be at the same indentation as the lines before them, but they are obviously not.

Once you fix this indentation so you can compile, you have caused a logic problem by un-indenting code that needs to be part of the while guess_count < 5: loop.

Be patient, go carefully and read the compiler messages. Indent the code that was part of the while loop (in previous postings) but that is not anymore due to this problem you encountered.

I'm currently using this python idle and it doesn't give me this precise error. So I ran it under the command prompt and I got line 20
print guess, "has already been guessed"
System error invalid syntax.
Can you suggest which compiler or whatever it's called that shows the error messages that you are getting. Because my compiler or whatever it's called doesn't display that IndentationError" unexpected indent.
It would help a lot instead that generic error message I got in the beginning.

The error I posted was from the command-line compiler.

I'm running:

python --version
Python 2.5.2

The error message was generated with:

python foo.py

where foo.py contained the code you had posted.

The line:

print guess, "has already been guessed ")

does have a syntax error...what's that last closing paren ')' for?

Thanks missed that darn parenthesis.
Ran the complete program enter the letter a twice.
It should have displayed "has already been guessed"
Is it because guess has no define value?
If so I set guess = "" still had the same result.

import random
#list of words the computer will be picking
word_list = ['python', 'jumble', 'easy', 'difficult', 'answer', 'tracer', 'muffin']

print "I'm picking one of the " , len(word_list), "words from a secret list"
random_word = random.choice(word_list)
print "Computer has selected secret word", len(random_word), "letters."
guess_count = 0
correct_guess = ""
wrong_guess = ""
previous = ""
correct = random_word
while guess_count< 5:
    guess_count+=1
    guess=raw_input("\nguess one letter ")
if guess in previous:
    print guess, ("has already been guessed ")
    guess_count -= 1 
    print guess, "is correct"
    correct_guess += guess
else:
    print guess, "is not correct"
    wrong_guess += guess
previous += guess
print correct_guess
print wrong_guess

print len(correct_guess), "correct guesses and", len(wrong_guess), "incorrect"
## guessing the word
print "Guess the word"
guess = raw_input ("\nYour guess:")
guess = guess.lower()
while (guess != correct) and (guess !=""):
    tries+=1
    if guess > correct:
        print "Incorrect.."
    elif guess < word:
        print "Incorrect.."
    else:
        raw_input("\n\nPress the enter key to exit.")
if guess == correct:
   print "That's it! You guessed it!\n"

print "Thanks for playing."
raw_input("\n\nPress the enter key to exit.")

print "Thanks for playing"

I tried to explain about indenting before...

Your while loop that starts on line 13 only contains line 14 and line 15. Line 16 will not be executed until the while is complete.

You lost an elif statement between lines 18 and 19...

The while loop used to go through line 26 in previous versions of the code.

The while loop starting on line 33 will keep looping until you get the right guess or enter a blank line, but the loop doesn't contain code to prompt for another guess.

line 34 is incrementing tries. Where did tries come from, do we use it anywhere?

The tests for incorrect on lines 35 and 37 can be performed as a single if guess != correct:

Fixed some of the problems. Still work in progress.
Have to figure out why not getting the correct letter.

import random #list of words the computer will be picking word_list = ['python', 'jumble', 'easy', 'difficult', 'answer', 'tracer', 'muffin']

print "I'm picking one of the " , len(word_list), "words from a secret list" random_word = random.choice(word_list) print "Computer has selected secret word", len(random_word), "letters."

guess_count = 0 correct_guess = "" wrong_guess = "" previous = "" correct = random_word

while guess_count< 5: guess_count+=1 guess=raw_input("\nguess one letter ")

if guess in previous: print guess, ("has already been guessed ") guess_count -= 1

print guess, "is correct" correct_guess += guess

else: print guess, "is not correct" wrong_guess += guess

previous += guess

print correct_guess print wrong_guess

print len(correct_guess), "correct guesses and", len(wrong_guess), "incorrect"

## guessing the word

print "Guess the word" guess = raw_input ("\nYour guess:") guess = guess.lower() while (guess != correct) and (guess !=""): if guess != correct: print "Incorrect.." raw_input("\n\nPress the enter key to exit.")

if guess == correct: print "That's it! You guessed it!\n"

print "Thanks for playing." raw_input("\n\nPress the enter key to exit.")

print "Thanks for playing" [/python][code= python]import random
#list of words the computer will be picking
word_list =

print "I'm picking one of the " , len(word_list), "words from a secret list"
random_word = random.choice(word_list)
print "Computer has selected secret word", len(random_word), "letters."

guess_count = 0
correct_guess = ""
wrong_guess = ""
previous = ""
correct = random_word

while guess_count< 5:
guess_count+=1
guess=raw_input("\nguess one letter ")

if guess in previous:
print guess, ("has already been guessed ")
guess_count -= 1

print guess, "is correct"
correct_guess += guess

else:
print guess, "is not correct"
wrong_guess += guess

previous += guess

print correct_guess
print wrong_guess

print len(correct_guess), "correct guesses and", len(wrong_guess), "incorrect"

## guessing the word

print "Guess the word"
guess = raw_input ("\nYour guess:")
guess = guess.lower()
while (guess != correct) and (guess !=""):

if guess != correct:
print "Incorrect.."
raw_input("\n\nPress the enter key to exit.")


if guess == correct:
print "That's it! You guessed it!\n"

print "Thanks for playing."
raw_input("\n\nPress the enter key to exit.")

print "Thanks for playing"
[/python]

you're still missing the elif guess in correct: before the print guess,"is correct" I'm hoping its just the broken code tag that caused it, or you lost your indentation.

Thanks it fixed that problem. Found new issue
if I entered the incorrect word outputs-
incorrect (expected behavior)
Thanks for playing (expected behavior)
Press enter key to exit (expected behavior)
Hit <Enter>
It will repeat the same messages and won't exit.
Why is it looping again?
If I enter the correct word it works fine and able to exit the program.

import random
#list of words the computer will be picking
word_list = ['python', 'jumble', 'easy', 'difficult', 'answer', 'tracer', 'muffin']

print "I'm picking one of the " , len(word_list), "words from a secret list"
random_word = random.choice(word_list)
print "Computer has selected secret word", len(random_word), "letters."

guess_count = 0
correct_guess = ""
wrong_guess = ""
previous = ""
correct = random_word

while guess_count< 5:
    guess_count+=1
    guess=raw_input("\nguess one letter ")

    if guess in previous:
       print guess, ("has already been guessed ")
       guess_count -= 1
       
    elif guess in correct:
       print guess, "is correct"
       correct_guess += guess

    else:
        print guess, "is not correct"
        wrong_guess += guess

        previous += guess

print correct_guess
print wrong_guess

print len(correct_guess), "correct guesses and", len(wrong_guess), "incorrect"

## guessing the word

print "Guess the word"
guess = raw_input ("\nYour guess:")
guess = guess.lower()
while (guess != correct) and (guess !=""):
    
   if guess != correct:
        print "Incorrect..\n"

   print "Thanks for playing."     
   raw_input("\n\nPress the enter key to exit.")
        

if guess == correct:
   print "That's it! You guessed it!\n"

print "Thanks for playing."
raw_input("\n\nPress the enter key to exit.")
while (guess != correct) and (guess !=""):
    
   if guess != correct:
        print "Incorrect..\n"

   print "Thanks for playing."     
   raw_input("\n\nPress the enter key to exit.")
        

if guess == correct:
   print "That's it! You guessed it!\n"

print "Thanks for playing."
raw_input("\n\nPress the enter key to exit.")

Looky here: you've got an infinite loop with the while statement. Especially because inside that while loop you're not updating the value of guess. So it will just repeatedly print and ask the user to press enter...

This question has already been answered. Start a new discussion instead.