[英]I have an indentationerror: Expected an indented block
你好,下面是我的代码即将发布的第64行附近的问题quiz = difficulty_level(user_level)有人可以帮忙吗? 每次我运行它都会出现这个错误,对于我的生活,我无法弄清楚发生了什么或出了什么问题
def play():
quiz = difficulty_level(user_level):
print
print quiz
print "\nYou have only 5 tries best of luck.\n"
answers_list = relate_answer(user_level)
blanks_index = 0
answers_index = 0
number_of_guesses = 5
guesses_limit = 0
while blanks_index < len(blanks):
user_answer = raw_input("type in your answer for " + blanks[blanks_index] + ": ")
if check_answer(user_answer,answers_list,answers_index) == "Correct":
print "nice job! that is the right answer!\n"
quiz = quiz. replace(blanks[blanks_index],user_answer)
blanks_index += 1
answers_index += 1
number_of_guesses = 5
print quiz
if blanks_index == len(blanks):
print "Congrats"
else:
number_of_guesses -= 1
if number_of_guesses == guesses_limit:
print "Game over!"
break
elif number_of_guesses < guesses_limit:
print "invalid"
break
else:
print "incorrect try one more time"
print "You have" + str(number_of_guesses) + "This many guesses left"
play()
更改
while blanks_index < len(blanks):
user_answer = raw_input("type in your answer for " + blanks[blanks_index] + ": ")
if check_answer(user_answer,answers_list,answers_index) == "Correct":
至
while blanks_index < len(blanks):
user_answer = raw_input("type in your answer for " + blanks[blanks_index] + ": ")
if check_answer(user_answer,answers_list,answers_index) == "Correct":
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.