我一直收到包含“count = 0”的行的错误。我不确定为什么,因为这是我试图设置的原始默认值..
max = int(input("enter The number of butterflies that is required: "))
count = 0
while count <= max:
butterfly=int(input("how many butterflys did u see: "))
if butterfly >=1:
count = butterfly+count
else:
count=count
butterfly=input("how many did u see: ")
print("you have reached,",max)
错误行: IndentationError:unindent与第5行的任何外部缩进级别都不匹配 如果蝴蝶> = 1:
答案 0 :(得分:1)
您忘记在第1行关闭括号,并在第14行中添加一个
答案 1 :(得分:0)
这是一个有效的例子
max = int(input("enter The number of butterflies that is required: "))
count = 0
while count <= max:
butterfly=int(input("how many butterflys did u see: "))
if butterfly >=1:
count += butterfly
butterfly=input("how many did u see: ")
print("you have reached,",max)