Advertisement
1nikitas

Untitled

Apr 6th, 2022
965
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.54 KB | None | 0 0
  1. import math
  2. def solve(a=0,b=0,c=0):
  3.     if a==0 and b==0 and c==0:
  4.         return ['all']
  5.     elif a == 0 and b == 0:
  6.         return []
  7.     elif a==0:
  8.         return [(c*(-1))/b]
  9.     elif b==0:
  10.         return [math.sqrt((-1*b)/a)]
  11.     elif  c==0:
  12.         return[0, (-1*b)/a]
  13.     else:
  14.         q = b**2
  15.         w = -4*a*c
  16.         D = q+w
  17.         if D<0:
  18.             return[]
  19.         elif D== 0:
  20.             return[(-1*b)/(2*a)]
  21.         else:
  22.             D = math.sqrt(D)
  23.             return[int(((-1*b)-D)/(2*a)), ((-1*b)+D)/(2*a) ]
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement