Advertisement
Anastasiiauser

Untitled

Dec 6th, 2020
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.37 KB | None | 0 0
  1. def solver(a,b,c):
  2.     D = b**2 - 4*a*c
  3.     if D == 0:
  4.         x = (-b + D**0.5) / (2*a)
  5.         return x
  6.     elif D > 0:
  7.         x1 =  (-b + D**0.5) / (2*a)
  8.         x2 =  (-b - D**0.5) / (2*a)
  9.         return x1, x2
  10.     elif D < 0:
  11.         return "Корней нет"
  12. a, b, c = float(input('a = ')), float(input('b = ')), float(input('c = '))
  13. print(solver(a, b, c))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement