Discuss / Python / 作业

作业

Topic source

stupid_seeker

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

import math a=int(input('Number a:')) b=int(input('Number b:')) c=int(input('Number c:')) def quadratic(a,b,c): if a==0: print('Wrong number:a can not be zero') return elif bb-4ac<0: print('Equation have no real number roots') return elif bb==4ac: x=-b/(2a) print('Equation have two same real number roots') return x s=math.sqrt(bb-4ac) x1=(-b+s)/(2a) x2=(-b-s)/(2a) print('Equation have two different real number roots') return x1,x2 print('Equation roots are:',quadratic(a,b,c))


  • 1

Reply