所以我想试着猜出这些混淆的单词需要多少次。坦白地说,我被困了这么久,因为这段代码根本不起作用。请帮忙。在
#Word Jumble Game
import random
import string
words = ['Jumble', 'Star', 'Candy', 'Wings', 'Power', 'String', 'Shopping', 'Blonde', 'Steak', 'Speakers', 'Case', 'Stubborn', 'Cat', 'Marker', 'Elevator', 'Taxi', 'Eight', 'Tomato', 'Penguin', 'Custard']
def jumbled():
word = string.lower(random.choice(words))
jumble = list(word)
random.shuffle(jumble)
scrambled = "".join(jumble)
print '\n',scrambled,'\n'
guess = raw_input('Guess the word: ')
count=0
if guess == word:
print '\n','Correct!'
else:
print '\n','Try again!','\n',jumbled()
count+=1
jumbled()
给你。我为你修好了几件事。我的修复将在下面的代码注释中提到。如果你帮我修改了密码,请告诉我。在
这将按照你想要的方式运行。在
相关问题 更多 >
编程相关推荐