Discuss / Python / 作业打卡、亲测有效

作业打卡、亲测有效

Topic source

A丶回手掏

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

import math

def quadratic(a,b,c): p=bb-4ac if p>=0 and a!=0:#一元二次方程有解的条件 x1=(-b+math.sqrt(p))/(2a) x2=(-b-math.sqrt(p))/(2*a) return x1,x2 elif a==0:#a=0的情况下为一元一次方程 x1=x2=-c/b return x1 else: return('方程无解!')

a=float(input('Please input a=')) b=float(input('Please input b=')) c=float(input('Please input c=')) print(quadratic(a,b,c))

A丶回手掏

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

这个网页自动省略的乘号(*)


  • 1

Reply