python的代码错误,可以帮我看看这一段代码哪里错了吗?

#!/usr/bin/python
# -*- coding: UTF-8 -*-
a=3
b=2
c=0
if a == 0 and b == 0 :
print"不是方程"
else:
d= b*b-4*a*c
if d >= 0 :
print "x1=",-b+pow(d,1/2)/2/a
print "x2=",-b-pow(d,1/2)/2/a
else:
print"方程无实根"

File "main.py", line 13
else:
^
IndentationError: unindent does not match any outer indentation level

a=3
b=2
c=0
if a == 0 and b == 0 :
print("不是方程")
else:
d= b*b-4*a*c
if d >= 0 :
print("x1=",-b+pow(d,1/2)/2/a)
print("x2=",-b-pow(d,1/2)/2/a)
else:
print("方程无实根")

PS:注意代码行的缩进,这在Python程序中表示层级关系;还有print语句后有英文状态下的括号

温馨提示:答案为网友推荐,仅供参考
第1个回答  2020-04-21
这段英文不是告诉你了

文件“main.py”,第13行
else:
^
缩进错误:未缩进与任何外部缩进级别都不匹配
一般出错都有提示你哪里错的,如果看不懂可以用翻译软件翻译一下,学习编程要学会运用翻译软件
第2个回答  2020-04-21
你的缩进错了。应该要把第13行的else缩进改一下
相似回答