Discuss / Python / 交作业啦~

交作业啦~

Topic source

Wizology

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

-- coding: utf-8 --

import math def quadratic(a, b, c): p = b*2-4ac x1= (-b + math.sqrt(p))/(2a) x2= (-b - math.sqrt(p))/(2*a) if p>=0: return(x1, x2) else: print('Wrong Number, Plz Check')

a = float(input('请输入a的值:')) b = float(input('请输入b的值:')) c = float(input('请输入c的值:')) p = b*2-4a*c

if p>=0: print(quadratic(a,b,c)) else: print('Wrong Number, Plz Check')


  • 1

Reply