newb?

扫码查看
同样的问题,容易变量(你还没有定义)。你想说的是 而word ==easy: Same problem here, easy is a variable (which you haven''t defined). What you meant to say was while word == "easy": 同上。但是当你的单词列表变大时,这将变得乏味。你应该把你的单词和他们的提示存储在字典中: 提示= {''easy'':''不难,但'',''python'':'''蛇''} 然后你需要一个代码块,可以打印提示使用正确的单词来查找字典中的暗示。 如果猜= =提示:打印提示[正确] guess = raw_input("你的猜测:") guess = guess.lower() Ditto. But this is going to get tedious when your word list gets large. You should have your words and their hints stored in a dictionary: hints = {''easy'':''not hard but'',''python'':''snake''} then you need just a single code block that can print the hint by using the correct word to look up the hint in the dictionary. if guess == hint: print hints[correct] guess = raw_input("Your guess: ") guess = guess.lower() 这篇关于newb?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-04 03:02
查看更多