I am teaching a Python crash course and thought a Hangman rendition would be fruitful.I have an end product that I'll work towards with the hour that I have for the course and I was wondering what could be refactored or implemented to help the exchange of information from myself, intermediate level, to absolute beginners.from random import choiceimport osdef clear():    os.system('clear')def play_again():    play_again = input(\nPlay again? Y/n ).lower()    if play_again != 'n':        clear()        game()    else:        print(\n\n\n\nCatch ya later!\n\n\n\n)def get_secret_word():    words = ['angry', 'beautiful', 'brave', 'careful', 'charismatic', 'clever',             'creative', 'cute', 'dangerous', 'exciting', 'famous', 'friendly',             'happy', 'interesting', 'lucky', 'profound', 'popular', 'rich',             'thin', 'young']    secret_word = choice(words)    return secret_worddef get_guess(bad_guesses, good_guesses, secret_word):    while True:        guess = input(Guess a letter: ).lower()        if guess == '':            print(What was that?)            board(bad_guesses, good_guesses, secret_word)        elif len(guess) != 1:            input(You can only guess a single letter!)            board(bad_guesses, good_guesses, secret_word)        elif guess in bad_guesses or guess in good_guesses:            input(You've already guessed that letter!)            board(bad_guesses, good_guesses, secret_word)        elif not guess.isalpha():            input(You can only guess LETTERS!)            board(bad_guesses, good_guesses, secret_word)        else:            return guessdef board(bad_guesses, good_guesses, secret_word):    clear()    print('** Strikes: {}/8 **'.format(len(bad_guesses)))    print('')    for guess in bad_guesses:        print(guess, end= )    print('\n\n')    for guess in secret_word:        if guess in good_guesses:            print(guess, end= )        else:            print('_ ', end= )    print('')def game():    secret_word = get_secret_word()    good_guesses = []    bad_guesses = []    game_done = False    while not game_done:        board(bad_guesses, good_guesses, secret_word)        guess = get_guess(bad_guesses, good_guesses, secret_word)        if guess in secret_word:            good_guesses.append(guess)            found = True            for guess in secret_word:                if guess not in good_guesses:                    found = False            if found:                print(\nYou win!\n)                print(The secret word was {}..format(secret_word.upper()))                game_done = True        elif guess not in secret_word:            bad_guesses.append(guess)            if len(bad_guesses) == 8:                clear()                print(\n **  ENGHH!  ** )                print(\nStrike ! You lost!)                print(\nThe secret word was {}.format(secret_word.upper()))                game_done = True        if game_done:            play_again()        else:            board(bad_guesses, good_guesses, secret_word)game()
Hangman implementation for teaching a Python course
python;beginner;python 3.x;hangman