Discuss / Python / * 号 被吃了

* 号 被吃了

Topic source

wxg122_858

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

import math

def quadratic(a,b,c) : try : if not isinstance(a+b+c,int): raise TypeError('param must be int') except TypeError as e : raise e if a == 0 : raise ValueError('The coefficient of quadratic term cannot be zero') r = bb - 4ac if r < 0 : return sqrt_r = math.sqrt(r) return (-b+sqrt_r) / (2a), (-b - sqrt_r) / (2*a)


  • 1

Reply