Hangman Game with Python I'm super excited to share my hangman game with you. (haven't added the graphics yet...)
I will be using this program as my final project (for school), but I would like to have this polished before handing it in. I have given my program the limit of 7 attempts, but if the user continues to guess the wrong letters and then suddenly guesses the right letter, the attempt count stays where it's at.
Here's what I mean:
Let's say the word the computer has chosen is 'cougar' (I'm going to pretend I don't actually know this).
BTW this is on my console:
Guess the word: ______
7 chances left

a # &lt;-- my input (1st actual input)
Yes! a is in the word!

Guess the word: ____a_
7 chances left

b # &lt;-- my input (2nd actual input)
Sorry, b is not in the word. Try again.

Guess the word: ____a_
6 chances left

b # &lt;-- my input (this was just to test out if my program would let me know that I have repeated a letter)
You already guessed b. Please try another one!

Guess the word: ____a_
6 chances left

t # &lt;-- my input (3rd actual input)
Sorry, t is not in the word. Try again.

Guess the word: ____a_
5 chances left

q # &lt;-- my input (4th actual input)
Sorry, q is not in the word. Try again.

Guess the word: ____a_
4 chances left

r # &lt;-- my input (5th actual input)
Yes! r is in the word!

Guess the word: ____ar
4 chances left

h # &lt;-- my input (6th actual input)
Sorry, h is not in the word. Try again.

Guess the word: ____ar
3 chances left

c # &lt;-- my input (7th actual input)

this is where the program should've initially said
'Sorry, you ran out of attempts. The word was cougar. Maybe next time ☹.
instead, I get this:
Yes! c is in the word!

Guess the word: c___ar
3 chances left # &lt;-- this is WRONG!!

g # &lt;-- my input (my 1st extra attempt)
Yes! g is in the word!

Guess the word: c__gar
3 chances left

i # &lt;-- my input (my 2nd extra attempt)
Sorry, i is not in the word. Try again.

Guess the word: c__gar
2 chances left

o # &lt;-- my input (my 3rd extra attempt)
Yes! o is in the word!

Guess the word: co_gar
2 chances left

u # &lt;-- my input (my 4th extra attempt)
Yes! u is in the word!

Awesome! You guessed cougar!

So my program is supposed to allow only 7 attempts (with the exception of a repeated letter). As you can clearly see I got 12 attempts! Out of which only 8 were acceptable (7 actual attempts and 1 for repeating 'b'), meaning I got 4 EXTRA attempts. (this is what I need to fix).
Here's my code:
from random import choice

words = choice(['ant', 'alpaca', 'baboon', 'badger', 'bat', 'bear', 'beaver', 'camel', 'cat', 'clam', 'cobra', 'cougar',
                'coyote', 'crow', 'deer', 'dog', 'donkey', 'duck', 'eagle', 'ferret', 'fox', 'frog', 'goat', 'goose',
                'hawk', 'lion', 'lizard', 'llama', 'mole', 'monkey', 'moose', 'mouse', 'mule', 'newt', 'otter', 'owl',
                'panda', 'parrot', 'pigeon', 'python', 'rabbit', 'ram', 'rat', 'raven', 'rhino', 'salmon', 'seal',
                'shark', 'sheep', 'skunk', 'sloth', 'snake', 'spider', 'stork', 'swan', 'tiger', 'toad', 'trout',
                'turkey', 'turtle', 'weasel', 'whale', 'wolf', 'wombat', 'zebra'])

guessed = []
wrong = []
attempts = 7

while attempts &gt; 0:

    out = ''

    for letter in words:
        if letter in guessed:
            out = out + letter
        else:
            out = out + '_'

    if out == words:
        break

    print('Guess the word:',out)
    print(attempts,'chances left\n')

    guess = input()

    if guess in guessed or guess in wrong:
        print('You already guessed',guess+ '.','Please try another one!')
    elif guess in words:
        print('Yes!',guess,'is in the word!')
        guessed.append(guess)
    else:
        print('Sorry,',guess,'is not in the word. Try again.')
        attempts = attempts - 1
        wrong.append(guess)

    print()

if attempts:
    print('Awesome! You guessed',words + '!')
else:
    print('Sorry you ran out of attempts. The word was',words + '.', 'Maybe next time ☹')
You are improving, that's nice.
Since the project is quite minimal, I would just highlight few points for consideration.
Misleading variable names
words and out are misleading, what does out mean, your variables should explain themselves clearly and be as unambiguous as possible, words gives the intent of holding multiple words but actually, it holds just a word.
You might not need it
wrong list is totally unnecessary here, you might have implemented it for future purposes but right now, it isn't really used, define only what you are currently using. So it means guess in wrong is an irrelevant check
guessed happens to append only correct guesses, that's misleading, you might want to make it append both correct and wrong guess and it makes the variable wrong even more irrelevant.