Advertisement
Serafim_

Вывод текста , D

Nov 1st, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.66 KB | None | 0 0
  1. input_file=open("Hello.txt")
  2. line =input_file.read()
  3. a=line.split()
  4. for i in range (0,3,1):
  5.     a[i]=float(a[i])
  6.  
  7.  
  8. from math import sqrt
  9. def f(a,b,c):
  10.     d=b*b-4*a*c
  11.     if d<0:
  12.         print None
  13.         return
  14.     x_1=(-b+sqrt(d))/(2*a)
  15.     x_2=(-b-sqrt(d))/(2*a)
  16.     print x_1, x_2
  17.  
  18.  
  19. f(a[0],a[1],a[2])
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27. from math import sqrt
  28. def f(A):
  29.     a = A[0];b=A[1];c=A[2]
  30.     d=b*b-4*a*c
  31.     if d<0:
  32.         print None
  33.         return
  34.     x_1=(-b+sqrt(d))/(2*a)
  35.     x_2=(-b-sqrt(d))/(2*a)
  36.     print x_1, x_2
  37.  
  38.  
  39. input_file=open("Hello.txt")
  40. for line in input_file:
  41.     a=line.split()
  42.     for i in range (0,3,1):
  43.         a[i]=float(a[i])       
  44.     f(a)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement