```python
import random
万圣节主题的单词列表
vocabulary = ["bat", "broom", "candy", "pumpkin", "skeleton", "witch", "ghoul", "zombie", "bat", "cauldron", "cobweb", "crematorium", "fang", "Frankenstein", "ghastly", "ghost", "graveyard", "hex", "imp", "mummy", "nightmare", "phantom", "spider", "witchcraft"]
随机生成一个单词作为谜底
answer = random.choice(vocabulary)
提示用户输入答案
print("I'm thinking of a Halloween-themed word. Can you guess what it is?")
guesses = ""
max_turns = 10
turns = 0
while turns < max_turns and guesses != answer:
guess = input("Enter your guess: ").lower()
guesses += guess + " "
turns += 1
if guess in vocabulary:
print("Good job! You guessed it.")
else:
print("Sorry, that's not correct. You have used all your turns.")
print("The correct word was:", answer)
print("Game over. Thanks for playing!")
```
这个程序会随机选择一个与万圣节相关的单词作为谜底,然后让用户在最多10轮的猜测中尝试猜出这个单词。如果用户猜对了,程序会输出一条祝贺信息;如果用户没有猜对,程序会告诉用户他们已经用完了猜测次数,并显示正确的答案。