我试图解决这个问题很多次,但我不能解决我尝试了一切,但每次都显示错误信息
a=int(input('enter the first number')) #we ask for input
b=int(input('enter the second number'))
while True:
choice=int(input('enter the number corresponding to the operation you want to \nperform \n1)addition \n2)subtraction \n3)multiplication \n4)division '))
#we ask for the user choice
if choice==1: #if the user opts for addition
addition=a+b
print(f'the addition of the 2 numbers is {addition} ') #ans
ans=input('want to try another operation? yes or no')
if ans=='yes': #if the user whishes to use another operation
continue
else: #if the user opts out
print('thank you for using')
break
elif choice==2:
subtraction=a-b #same for others but diffrent opperation
print(f'the subtraction of the 2 numbers is {subtraction} ')
ans=input('want to try another operation? yes or no')
if ans=='yes':
continue
else:
print('thank you for using')
break
elif choice==3:
multiplication=a*b
print(f'the multiplication of the 2 numbers is {multiplication} ')
ans=input('want to try another operation? yes or no')
if ans=='yes':
continue
else:
print('thank you for using')
break
else:
division=a//b
remainder=a%b
print(f'the division of the 2 numbers is {division} \nand the remainder is{remainder} ')
ans=input('want to try another operation? yes or no')
if ans=='yes':
continue
else:
print('thank you for using')
break
错误消息是
File "calc_of_2_nos.py", line 15
break ^
IndentationError: unindent does not match any outer indentation level
我不知道怎么解决这个问题,我想我已经把它缩进四个空格了
我找不到错误。你呢可能需要添加一个新行后分割在您的菜单选择,否则它的完美!你知道吗
有时,如果我把标签和空格混在一起,这种情况就会发生在我的崇高文本中。我是专门为崇高的文本回答,因为这是你说你在评论中使用。你知道吗
在Sublime文本中,当突出显示空白时,实际上可以看到它是选项卡还是空格,如下所示:
注意左边的两个箭头。你看到点的地方有空格,看到线的地方有标签。你知道吗
为了使代码的间距保持一致,我建议您要么手动返回并删除代码,然后手动并一致地重新缩进代码,要么使用linter重新缩进。Sublime Text为此(
view -> indentation -> *
)和tools exist online提供了一些工具。你知道吗Sublime文本中另一个有用的技巧是在文件中搜索制表符并用
(空格)替换它们。你知道吗
相关问题 更多 >
编程相关推荐