<jupyter_start><jupyter_text>Hangman game<jupyter_code>print("Welcome to Hangman game!")

print(" Hangman rules: \n"
    +"I have a secret word \n"
    +"You need to guess each letter in the word \n" 
    +"If your guess matches the secret word letter then you win\n"
    +"If your guess does not match the secret word letter then you loose\n"
    +"and you will make a step forward to be hanged.\n")

name=input('What is your name? ')

import random
words=["Ironhack", "computer", "team", "beer", "weekend"]
secret_word = random.choice(words)

def get_guess():
    dashes = "-" * len(secret_word)
    guesses_left=len(secret_word)+3
    
    while guesses_left>-1 and not dashes == secret_word:
        print(dashes)
        print(guesses_left)
        
        guess = input("Make your guess: ")
        
        if len(guess)!=1:
            print('Your guess should have at least 1 character')
        elif guess in secret_word:
            print('This letter is in the secret word!')
            dashes = update_dashes(secret_word, dashes, guess)
            guesses_left -=1
        else:
            print('This letter is not in the secret word!')
            guesses_left -=1
    if guesses_left<0:
        print('You lose! The secret word was', secret_word, '.\n' 'You are hung!')
    else:
        print('Congratulations! You win! The secret word was',secret_word,'.') 
get_guess()           

def update_dashes(secret, cur_dash, rec_guess):
    result = ""
    for i in range(len(secret)):
        if secret[i] == rec_guess:
            result = result + rec_guess     
        else:
            result = result + cur_dash[i]
    return result<jupyter_output>Welcome to Hangman game!
 Hangman rules: 
I have a secret word 
You need to guess each letter in the word 
If your guess matches the secret word letter then you win
If your guess does not match the secret word letter then you loose
and you will make a step forward to be hanged.

What is your name? an
----
7
Make your guess: t
This letter is in the secret word!
t---
6
Make your guess: e
This letter is in the secret word!
te--
5
Make your guess: a
This letter is in the secret word!
tea-
4
Make your guess: m
This letter is in the secret word!
Congratulations! You win! The secret word was team .
{'fraction_non_alphanumeric': 0.09082892416225749, 'fraction_numerical': 0.0048500881834215165, 'mean_word_length': 2.713584288052373, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '47432', 'license': 'Unlicense', 'n_tokens_mistral': 709, 'n_tokens_neox': 687, 'n_words': 287, 'path': 'Hangman game.ipynb', 'repo_name': 'ana-elena/par-apr-2019-prework', 'size': '2268'}