Hello this is Gulshan Negi
Well, I am writing a program for making hangman game in python but it shows some error at the time of its execution. Here is my source code:

import random
def select_word():
    words_in_computer_memory = ['magazine','stars','computer','python','organisation']
    word = random.choice(words_in_computer_memory)
    return word
def is_gussed(word, guessed_letter_list):
    count=0
    for letters in word:
        if letters in guessed_letter_list:
            count+=1:
    if count==len(word):
        return True
    else:
        return False
def guessed_word(word, guessed_letter_list): 
    string=""
    for key in word:
        if key in guessed_letter_list:
            string+=key
        else:
            string+="_ "
    return string
def available_letters(guessed_letter_list):

    string=""
    count=0
    s='abcdefghijklmnopqrstuvwxyz'
    for letter in s:
        if letter in guessed_letter_list:
            count+=1
        else:
            string+=letter
    return string
def hangman_game(word):  
    length=len(word)
    print('''------------------WELCOME TO HANGMAN GAME---------------------------
                                    O   
                                   /|\  
                                   / \  
        ''')
    print("The word you have to guess is of ",length, "letters long.")
    chances=2*len(word)
    i=0
    guessed_letter_list=[]
    while (chances!=0):     

        if word!=guessed_word(word, guessed_letter_list):
            print("You Got", chances, "Chances.")
            print("Letters you can enter should be from these ",available_letters(guessed_letter_list))
            guess=input("ENTER A LETTER ")
            print('\n'*50)

            guessInLowerCase = guess[0].lower()      
            if guessInLowerCase  in guessed_letter_list:
                print("SORRY! YOU HAVE GUSSED THIS LETTER ALREADY! ",guessed_word(word, guessed_letter_list))
            elif guessInLowerCase not in word: 
                print(" SORRY! THE LETTER IS NOT IN WORD",guessed_word(word, guessed_letter_list))
                chances-=1
            else:
                guessed_letter_list.append(guessInLowerCase)
                print("NICE YOU GUSESSED THE RIGHT LETTER! ",guessed_word(word, guessed_letter_list))

        elif word==guessed_word(word, guessed_letter_list):
            print("YOU WON!")
            break

    else:
        print('''
        ********************************************
   YOU LOSS!!
                                 O 
                                /|\  
                                / \  
     ******************************************''')
        print('The word was',word,)

word = select_word()
hangman_game(word)

Can anyone give their suggestions on this?
Thanks

AndreRet commented: What error and on which line? +15

some error at the time of its execution

What error do you get?

On line 10 you have count+=1:. Python will tell you that this is a syntax error. Take off the trailing colon. However this still leaves you with a problem. The game runs, but it does not display the hangman in progress when you guess a wrong letter.

@Reverend Jim Thanks a lot for your kind respond, yes it really work for me. @pritaeas problem soved now.
Thanks again.

Reverend Jim is totally correct. I modified your code a little to address the drawing of the hangman. Tested in Python fiddle - Python Sandbox -

import random

def select_word():
    words_in_computer_memory = ['magazine', 'stars', 'computer', 'python', 'organisation']
    word = random.choice(words_in_computer_memory)
    return word

def is_guessed(word, guessed_letter_list):
    count = 0
    for letter in word:
        if letter in guessed_letter_list:
            count += 1
    if count == len(word):
        return True
    else:
        return False

def guessed_word(word, guessed_letter_list): 
    string = ""
    for letter in word:
        if letter in guessed_letter_list:
            string += letter
        else:
            string += "_ "
    return string

def available_letters(guessed_letter_list):
    string = ""
    s = 'abcdefghijklmnopqrstuvwxyz'
    for letter in s:
        if letter not in guessed_letter_list:
            string += letter
    return string

def print_hangman(chances):
    stages = [
        '''
           --------
           |      |
           |      O
           |     \\|/
           |      |
           |     / \\
        ''',
        '''
           --------
           |      |
           |      O
           |     \\|/
           |      |
           |     / 
        ''',
        '''
           --------
           |      |
           |      O
           |     \\|/
           |      |
           |      
        ''',
        '''
           --------
           |      |
           |      O
           |     \\|
           |      |
           |     
        ''',
        '''
           --------
           |      |
           |      O
           |      |
           |      |
           |     
        ''',
        '''
           --------
           |      |
           |      O
           |    
           |      
           |     
        ''',
        '''
           --------
           |      |
           |      
           |    
           |      
           |     
        '''
    ]
    print(stages[chances])

def hangman_game(word):  
    length = len(word)
    print('''------------------WELCOME TO HANGMAN GAME---------------------------
                                    O   
                                   /|\\  
                                   / \\  
        ''')
    print("The word you have to guess is", length, "letters long.")
    chances = 2 * len(word)
    guessed_letter_list = []

    while chances != 0:
        if word != guessed_word(word, guessed_letter_list):
            print("You have", chances, "chances.")
            print("Letters you can enter should be from these:", available_letters(guessed_letter_list))
            guess = input("ENTER A LETTER: ").lower()
            print('\n' * 50)

            if guess in guessed_letter_list:
                print("Sorry! You have guessed this letter already!", guessed_word(word, guessed_letter_list))
            elif guess not in word: 
                print("Sorry! The letter is not in the word.", guessed_word(word, guessed_letter_list))
                chances -= 1
                print_hangman(chances)
            else:
                guessed_letter_list.append(guess)
                print("Nice! You guessed the right letter:", guessed_word(word, guessed_letter_list))
        elif word == guessed_word(word, guessed_letter_list):
            print("YOU WON!")
            break
    else:
        print('''
        ********************************************
        YOU LOST!!
                                 O 
                                /|\\  
                                / \\  
        ********************************************''')
        print('The word was', word)

word = select_word()
hangman_game(word)
commented: Thanks +0
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.