我正在为一个计算机科学项目做一个编码拼图。你知道吗
我做得很好,直到我遇到了一个缩进块错误。它在63号线上。你知道吗
任何帮助都会很好!!!你知道吗
代码如下:
#check to see if letters used
while True:
try:
x=words.index(answer1)
answer2=raw_input('Now please type the letter you wish to replace it with')
words=words.replace(answer1,answer2)
except ValueError:
print "there is an error using this letter/symbol, try again"
break
answer2=raw_input('Now please type the letter you wish to replace it with')
words=words.replace(answer1,answer2)
if words==check:
print"Congratulations"
else:
#routine to delete a previous guess
#find #if answer1=="+":
#if answer2=="C"
# +=C
#words2=words.replace(answer1,answer2)
问题在于
else
块。在Python中,缩进很重要,因此任何块都不能完全为空。如果else
语句打算什么也不做,那么写相关问题 更多 >
编程相关推荐