Discuss / Python / 调用函数报错求助

调用函数报错求助

Topic source

清寒藏韵

#1 Created at ... [Delete] [Delete and Lock User]

# -*- coding:utf-8 -*-

def quadratic(a,b,c):

import math

if b**2-4*a*c < 0:

return'该方程无解'

elif b**2-4*a*c == 0:

        x = -b/(2*a)

print('该方程只有一个解,该解为%-6.3f'%x)

else:

        x = (-b+math.sqrt(b**2-4*a*c))/(2*a)

        y = (-b-math.sqrt(b**2-4*a*c))/(2*a)

print('该方程有两个解,分别为%-6.3f和%-6.3f'%(x,y))

调用时报错

from what.quadratic import quadratic

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

  File "..\what\quadratic.py", line 7

    return -b/(2*a)

                  ^

TabError: inconsistent use of tabs and spaces in indentation

求助大佬指点!

解释器报错提示的缩进有问题


  • 1

Reply