Simple Python Games: Jumbled word

Source code of word_jumble.py

from random import choice, sample

words = ('apple', 'answer', 'juniper', 'question', 'tea', 'sea')

print()
print("Find jumbled words! (Ctrl+C to exit)")
print()

while True:
    the_word = choice(words).upper()
    shuffled = the_word
    while shuffled == the_word:
        shuffled = ''.join(sample(shuffled, len(shuffled)))
    print()
    print("Find the jumbled word of", shuffled, "!")
    player_input = input("Your quess: ")
    if player_input.upper() == the_word:
        print("Yes!")
    else:
        print("No.")
    print("It was", the_word)

Tips for improvement

  1. Add more words
  2. Add an "exit" option instead of Ctrl+C
  3. Display the player score
  4. Avoid repeating words in one session

Download

Source code of Jumbled word (word_jumble.py).