Python のループ内でループを実行して、単純な単語ゲームでポイントを作成するにはどうすればよいですか
import random
WORDS = ("python", "jumble", "easy", "difficult", "answer", "xylophone", "truck", "doom", "mayonase", "flying", "magic", "mine", "bugle")
play = "Yes"
points = 0
ask = ('Yes')
word = random.choice(WORDS)
while play == "Yes":
hint = word
correct = word
jumble = ""
while word:
position = random.randrange(len(word))
jumble += word[position]
word = word[:position] + word[(position + 1):]
print(
"""
Welcome to Word Jumble!
Unscramble the letters to make a word.
(Press the enter key at the prompt to quit.)
"""
)
print("The jumble is:", jumble)
guess = input("\nYour guess: ")
while guess != correct and guess != "":
print("Sorry, that's not it.")
guess = input("Your guess: ")
print("Do you want a hint")
if ask == "yes":
print(word)
points - 10
print(points)
if guess == correct:
print("That's it! You guessed it!\n")
play = input("Do you want to play again")
points + 100
print(points)
print("Thanks for playing.")
input("\n\nPress the enter key to exit.")
ポイントシステムを追加しようとしているすべてのコードです。私がやろうとしている問題は、「「Word Jumble」を改善して、各単語がヒントと対になるようにすることです。プレーヤーが行き詰まった場合にヒントを見ることができるようにする必要があります。ジャンブルを解決したプレーヤーに報酬を与えるスコアリング システムを追加します。ヒントを求めずに。」