Discuss / Python / 升级版

升级版

Topic source

fressman

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

import math def quadratic(a,b,c): nx1 = ((-b)+math.sqrt(b2-4ac))/(2*a) nx2 = ((-b)-math.sqrt(b2-4ac))/(2a) t =b**2-4a*c if not isinstance(a,(int,float)): raise TypeError('bad operand type') if not isinstance(b,(int,float)): raise TypeError('bad operand type') if not isinstance(c,(int,float)): raise TypeError('bad operand type') if a==0: return '不是一元二次方程' elif b==0 and a<0: return '无解' elif t < 0: return 'no value' elif t==0: return nx1 else: return nx1,nx2 print (quadratic(2,3,1)) print(quadratic(1,3,-4))

3嘿嘿3_0

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

请问在sublime里面定义的函数,怎样才能在python.exe里面调用呢?


  • 1

Reply