Carter Ellis
Carter Ellis
1,143 Points

Out of this word error.

I made my code in out of this word, but it won't work. Maybe I missed a part of the video? I thought I followed along pretty well, but I'm not sure

import random


def prompt_for_words(challenge):
    guesses = set()

def promt_for_words(challenge):
    guesses = set()
    print("What words can you find in the word '{}'".format(challenge))
    print("(Enter Q to Quit)");
    while True:
        guess = input("{} words >   ".format(len(guesses)))
        if guess.upper == "Q":
    return guesses

def output_results(results):
    for word in results:
        print("* " + word)

challenge_word = random.choice(WORDS)

player1_words = prompt_for_words(challenge_word)
player2_words = prompt_for_words(challenge_word)

print("Player 1 Results:")
player1_unique = playe1_words - player2_words
print("{} guesses, {} unique".formate(len(player1_words), len(player1_unique)))
print("-" * 10)
print("Player 2 Results:")
player2_unique = playe2_words - player1_words
print("{} guesses, {} unique".formate(len(player2_words), len(player2_unique)))

print("Shared guesses:")
shared_words = player1_words & player2_words
Steven Parker
Steven Parker
163,416 Points

To preserve your indentation (critical with Python!) use "Markdown" formatting. Instructions can be found in the Markdown Cheatsheet pop-up below the "Add an Answer" area. :arrow_heading_down:

Or for more detailed instructions, you can watch this video on code formatting.

1 Answer

Chris Freeman
Chris Freeman
Treehouse Moderator 55,177 Points

There are some typos:

  • promt_for_words instead of prompt_for_words
  • guess.ower() instead of guess.lower()
  • guess.upper missing ()
  • .formate() instead of format()
  • playe2_words instead of player2_words