Advertisement
Guest User

Untitled

a guest
Feb 16th, 2022
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. import math
  2. import cmath
  3. def input_coef(): #ввод данных
  4. print("Введите коэффициенты:")
  5. a=float(input("a="))
  6. b=float(input("b="))
  7. c=float(input("c="))
  8. d=float(input("d="))
  9. return a,b,c,d
  10.  
  11. def check(coef): #проверка, что уравнение кубическое
  12. a=float(coef[0])
  13. b=float(coef[1])
  14. c=float(coef[2])
  15. d=float(coef[3])
  16. print ("Заданы коэффициенты:", a, b, c, d)
  17. if abs(a) > 1e-6:
  18. return a, b, c, d
  19. else:
  20. return False
  21.  
  22. def Vieta(coef): #решение уравнения
  23. print ("заглушка")
  24. return x1, x2, x3
  25.  
  26.  
  27. coef = input_coef()
  28. check = check(coef)
  29. if check != False:
  30. roots = Vieta(coef)
  31.  
  32. else:
  33. print("Уравнение не кубическое")
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement