fork(1) download
  1. a = float(input('Введите а: '))
  2. b = float(input('Введите b: '))
  3. c = float(input('Введите c: '))
  4.  
  5. def f(a,b,c):
  6. return b**2-4*a*c
  7.  
  8. d = f(a,b,c)
  9.  
  10. if d>0:
  11. def f1(a,b,d):
  12. return (-b+d**(0.5))/(2*a)
  13. def f2(a,b,d):
  14. return (-b-d**(0.5))/(2*a)
  15. x1 = f1(a,b,d)
  16. x2 = f2(a,b,d)
  17. print(x1, x2)
  18.  
  19. elif d == 0:
  20. def f3(a,b,d):
  21. return (-((b)/(2*a)))
  22. x1_2 = f3(a,b,d)
  23. print(x1_2)
  24.  
  25. else :
  26. def f5(a,b,d):
  27. return (-b+d**(0.5))/(2*a)
  28. def f6(a,b,d):
  29. return (-b-d**(0.5))/(2*a)
  30.  
  31. x3 = f5(a,b,d)
  32. x4 = f6(a,b,d)
  33. print(x3,x4)
Runtime error #stdin #stdout #stderr 0.11s 22912KB
stdin
 
stdout
Введите а: 
stderr
Traceback (most recent call last):
  File "./prog.py", line 1, in <module>
ValueError: could not convert string to float: