Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from math import sqrt
- a=open("test.txt")
- def kv(a,b,c):
- d=b*b-4*a*c
- if (d<0):
- print "d<0"
- return
- x1=(-b+sqrt(d))/(2*a)
- x2=(-b-sqrt(d))/(2*a)
- if (d==0):
- x1=-b/(2*a)
- print x1
- return
- print x1,x2
- for line in a:
- b=line.split()
- for j in range (0,3,1):
- b[j] = float(b[j])
- kv(b[0],b[1],b[2])
Add Comment
Please, Sign In to add comment