import random
word_list = [
"apple", "banana", "orange", "grape", "melon", "kiwi", "pear", "peach", "plum", "cherry",
"dog", "cat", "elephant", "lion", "tiger", "giraffe", "monkey", "zebra", "panda", "koala",
"red", "blue", "green", "yellow", "orange", "purple", "pink", "brown", "black", "white",
"usa", "canada", "japan", "china", "germany", "france", "brazil", "india", "australia", "italy",
"football", "basketball", "tennis", "swimming", "volleyball", "baseball", "hockey", "golf", "boxing", "cricket",
"doctor", "teacher", "engineer", "chef", "actor", "artist", "pilot", "scientist", "lawyer", "firefighter",
"car", "bus", "train", "bike", "plane", "ship", "subway", "taxi", "helicopter", "boat",
"pizza", "burger", "pasta", "sandwich", "sushi", "icecream", "chocolate", "salad", "fries", "cake",
"sunny", "rainy", "cloudy", "windy", "snowy", "stormy", "foggy", "hot", "cold", "thunder",
"reading", "painting", "singing", "dancing", "cooking", "photography", "gardening", "gaming", "traveling", "writing"
]
def generate_anagram(word):
anagram = list(word)
random.shuffle(anagram)
return ''.join(anagram)
def main():
score = 0
used_words = []
print("Welcome to the Anagram Game!")
print("Unscramble the letters to form a word.")
while len(used_words) < len(word_list):
selected_word = random.choice(word_list)
# Check if the word has been used in this session
if selected_word in used_words:
continue
used_words.append(selected_word)
anagram = generate_anagram(selected_word)
print(f"Anagram: {anagram}")
user_input = input("Your guess: ").lower()
if user_input == selected_word:
print("Correct!")
score += 1
else:
print("Incorrect. Try again.")
print(f"Score: {score}\n")
print("Game Over. You've played with all the words!")
if __name__ == "__main__":
main()