예제 #1
0
def get_word(word_name):
    valid = False
    while not valid:
        word = raw_input("What is the " + word_name + " word? ")
        if dictionary.valid_word(word, "english2.txt"):
            valid = True
        else:
            print "That is not a word. Try again."
    return word
예제 #2
0
def get_word(which_word):
    is_valid = False
    while not is_valid:
        user_input = raw_input("Enter the " + which_word + " word: ")
        if dictionary.valid_word(user_input, "english2.txt"):
            is_valid = True
        else:
            print user_input + " is not a word.  Try again."
    return user_input
예제 #3
0
            
            if worthy:
                print("Congratulations, you can join the vacation! " + \
                      "\nMy rule was that " + \
                      "every item must have a double letter. (pp in apple).")
                finished = True
            else:
                print("I'm sorry, you did not get them all correct." + \
                      "\nAsk more questions!")

        elif item == "QUIT":
            print("Come back again if you think you can figure out the rule.")
            finished = True
            play = False

        elif not dictionary.valid_word(item, wordfile):
            print("That is not a valid word, please try again.")

        else:
            takeable = False
            i = 0
            while i < len(item) - 1:
                if item[i] == item[i + 1]:
                    takeable = True
                i += 1
            if takeable:
                print("Yes! You can bring that.")
            else:
                print("No, that's not allowed on this vacation.")

    # If they did not rage quit, then ask if they want to play again.