Ok, fixed that problem by putting in a break statement.
entered correct letter twice and now it won't display the statement
"has already been guessed" it was working darn it.

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"
   break
   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.")

Finally got the darn thing right. Forgot to put in the previous line-
previous += guess under the elif statement.
Now have to figure how to limit my input to one letter. Currently I can enter more than 1 letter. What's the command to do that function? Can't find it in the darn book.

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
       previous += 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"
   break
   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.")

In my test app, I didn't limit them to entering one letter, but I validated what they typed and complained if it was more than one character.

You could replace the raw_input and the first if test with a while loop:

while True:
    guess = raw_input("\nguess one letter ")
    guess = guess.strip().lower()
    if len(guess) > 1:
        print "Please enter only one letter"
   elif guess in previous:
        print guess, "has already been guessed "
   else:
        break

If you do, remember to change the elif guess in correct: to if guess in correct:

Ok I tried it enter two letters (ie aa) -
Responded back
Please enter one letter
aa
no
guess one letter
How do I prevent it from displaying the input "aa" and not even count this as on of my selections? Sorry for being picky it just doesn't feel right.

while True:
    
    guess=raw_input("\nguess one letter ")
    guess = guess.strip().lower()

    if len(guess) >1:
       print "Please enter only one letter."
    elif guess in previous:
       print guess, ("has already been guessed ")
       guess_count-=1
    else:
        break

When I put the while loop where it was supposed to go, I got the following from running it:

I'm picking one of the  7 words from a secret list
Computer has selected secret word 6 letters.

guess one letter er
Please enter only one letter.

guess one letter sd
Please enter only one letter.

guess one letter ght
Please enter only one letter.

guess one letter e
e is not correct

guess one letter rt
Please enter only one letter.

guess one letter r
r is not correct

guess one letter tr
Please enter only one letter.

guess one letter t
t is not correct

It looks like it is working to me.

while guess_count< 5:
    guess_count+=1

    while True:
        guess=raw_input("\nguess one letter ")
        guess = guess.strip().lower()

        if len(guess) >1:
           print "Please enter only one letter."
        elif guess in previous:
           print guess, ("has already been guessed ")
        else:
           break

    if guess in correct:

Here's the complete code, I still have that problem.

I'm picking one of the 7 words from a secret list
Computer has selected secret word 6 letters.

guess one letter er
Please enter only one letter.
er
no

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

  while True:
    
     guess=raw_input("\nguess one letter ")
     guess = guess.strip().lower()

     if len(guess) >1:
       print "Please enter only one letter."
     elif guess in previous:
       print guess, ("has already been guessed ")
       guess_count-=1
     else:
        break
       
     if guess in correct:
       print guess, "\nyes"
       correct_guess += guess
       previous += guess
     else:
        print guess, "\nno"
        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"
   break
   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.")

Can you use functions...you're having a hard time keeping the indenting right.

lines 31-38 should be out one indent...they need to be 'inside' the while guess_count < 5 but not 'inside' the while True

The "er no" is coming from line 36 but you're not supposed to get there until you've passed all the input tests.

I actually wrote a 'get me a letter' function and I call it from the main in my test app.

def getLetterGuess(previous):
    # Remind the user of the previous guesses if any
    if len(previous) > 0:
        print "You have already guessed:", ','.join(previous)
    # loop until we get a valid guess
    while True:
        lguess = raw_input("Guess a letter: ").strip().lower()
        if len(lguess) != 1:
            print "Enter only one character"
        elif not lguess.isalpha():
            print lguess,"is not a letter, please try again"
        elif lguess in previous:
            print "You have already guessed",lguess
        else:
            break
        print
    return lguess

Then I use it from the main like this:

# Take the Letter Guesses
for gidx in xrange(5):
    guess = getLetterGuess(previous)
    if guess in random_word:
        print "Yes,", guess, "is in the word"
        correct_guess += guess
    else:
        print "Sorry,", guess, "is not in the word"
        wrong_guess += guess
    previous += guess

Wish I could use it, but i'm not allowed to use the define function.
It's in the next chapter.
Wish I could life would be much easier.

Now it works for entering 2 characters, but something else got screwed up. See below
I'm picking one of the 7 words from a secret list
Computer has selected secret word 6 letters.
guess one letter aa
Please enter only one letter.
guess one letter e
guess one letter t
guess one letter f
guess one letter g
guess one letter y
y
no

y
0 correct guesses and 1 incorrect
Guess the word
It only gives y or n for the last letter I picked.

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

      while True:    
        guess=raw_input("\nguess one letter ")
        guess = guess.strip().lower()

        if len(guess) >1:
          print "Please enter only one letter."
        elif guess in previous:
          print guess, ("has already been guessed ")
          guess_count-=1
        else:
          break


if guess in correct:
   print guess, "\nyes"
   correct_guess += guess
   previous += guess
else:
   print guess, "\nno"
   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"
   break
   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.")

You moved the lines too far out...(sigh)

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

      while True:    
          guess=raw_input("\nguess one letter ")
          guess = guess.strip().lower()

          if len(guess) >1:
              print "Please enter only one letter."
          elif guess in previous:
              print guess, ("has already been guessed ")
              guess_count-=1
          else:
              break


      if guess in correct:
         print guess, "\nyes"
         correct_guess += guess
         previous += guess
      else:
         print guess, "\nno"
         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"
   break
   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.")

Thanks for your patience Murtan. Everything works now finally.

CAN ANYONE ASSIST ME WITH THIS PROGRAM ESPECIALLY THE LAST PART (DEF PLAY) QUESTION. IM JUST A BEGINNER IN PROGRAMMING
Implement a function word_list() that reads the 5_letter_words.txt file and returns a list of the words in the file.
Implement a function random_word() that takes a list of words as a parameter and returns a random word from this list.
Implement a function is_real_word() that takes two parameters, a guess and a word list and returns True if the word is in the word list and False otherwise.
Implement a function check_guess()that takes two parameters. The first is the guessed word and the second is the word the user has to find. checkguess() returns a string containing the following characters:
X for each character in the guess that is at the correct position.
O for each character in the guess that is in the word but not at the correct position.
for each character in the guess that is not part of the word. For example, check_guess("birds", "words") should return __XXX.
If a letter is used twice in the guessed word and exists only once in the word to be found, then only one letter in the return string is marked. In case one of the two letters is positioned correctly, then this letter is marked with an X in the return string. For example, check_guess("carat", "train") should return _OO_O. Another example, check_guess("taunt", "train") should return XOO
Implement a function next_guess() that takes a word list as a parameter. The function asks the user for a guess, converts the guess to lower case and checks if the guess is in the word list. If this is the case, the guess is returned. Otherwise, the function asks the user for another guess.
Implement a function play() that:
Uses the functions word_list and random_word to select a random 5 letter word.
Asks the user for a guess using the next_guess function.
Checks each guess using the check_guess function and shows the result to the user.
Checks if the users guessed the right word with six guesses or less. If yes, the user wins and the function prints You won!. Otherwise the user loses and the function prints You lost! as well as The word was: followed by word the user had to find.

Quoted Text Here

commented: Burying a question or request in a 14+ year old discussion is unlikely to be noticed. +17

Sure. Three things:

  1. You should start a new thread for this
  2. You should show us what you have so far
  3. You should tell us where you are stuck
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.