我是新來的蟒蛇,我只是在做這個應用的Python PROGRAME是攪亂字猜謎
import random
# create a sequence of words to choose from
WORDS = ("hello","goodbye","smile","evening","daytime")
#
# pick one word randomly from the sequence
word = random.choice(WORDS)
# create a variable to see if the guess is correct
correct = word
# create a jumbled version of the word
jumble =""
while word:
position = random.randrange(len(word))
jumble += word[position]
word = word[:position] + word[(position + 1):]
# start the game
print(\
"""
Welcome to the anagram quiz!
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: ")
guess = guess.lower()
while (guess != correct) and (guess != ""):
print ("Sorry, that's not it.")
guess = input("Your guess: ")
guess = guess.lower()
if guess == correct:
print ("That's it! You guessed it!\n")
print ("Thank you for playing.")
input("\n\nPress the enter key to exit.")
正如你可以看到最多混爲一談一個詞爲用戶猜詞是什麼,我需要能夠改善這一點,以便用戶在被卡住時得到提示,並添加一個評分系統來獎勵那些解決雜亂而不要求提示的人。
我試過幾個小時,有沒有在那裏,你能不能幫我在添加功能。
謝謝。
你的具體問題是什麼? – arshajii
你的提示和評分系統代碼是什麼樣的?評分可以基於時間來解決,不需要提示就可以設置獎勵... – learner