python拼写_Python拼写游戏

我已经提供了一个词的清单,将随机挑选游戏。它的作用是提示玩家输入所选单词的字母表。如果在所选单词中找到用户提供的字母,则会询问用户是否要尝试拼写整个单词。如果他们答应了,那么他们就能做到。否则,他们将不得不尝试进入另一个字母表。怎么我是否将每个用户输入的输出/结果打印为(例如:结果:a--------),如果用户最终对整个单词的拼写都说“是”,那么应该如何提示他们输入单词?

你想现在拼这个词吗?(是/否):是

拼写完整的单词:

你是对的!

正确的单词是albumen

拼另一个词?(是/否):是import random

wordList = ('apple', 'albumen', 'toothpaste', 'enthusiastic')

word = random.choice(wordList)

letter_guess = ""

word_guess = ""

store_letter = ""

count = 1

limit = 5

countLetters = len(word)

choice1 = ("Do you want to spell the word now? (y/n):")

choice2 = ("Spell another word? (y/n):")

choiceY = ("y")

choiceN = ("n")

startGame = print("The word ________ has {} letters. Spell it in 5 tries.".format(countLetters))

while count < limit:

letter_guess = input("Try {} - Current: ________. Your guess? ".format(count))

if letter_guess in word:

print ("yes")

print (input(choice1))

else :

print("no")

count += 1

if choice1 == choiceY:

print (input("Spell the complete word: "))

else:

print (letter_guess)

store_letter += letter_guess

count += 1

while count == limit:

spellFinal = input("Spell the complete word: ")

if spellFinal in word:

print ("You are correct!")

print ("Spell another word? (y/n):")

if choice == "y":

print (startGame)

else:

print('Remaining Words are: ', store_letter)

if spellFinal not in word:

print ("You are incorrect")

print ("The correct word is {}.".format(correct))

ZD7K1.png

e7854039559be1ead4e4abe7a6b0f936.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值