Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from math import sqrt
- a=open("test.txt")
- def kv(BLIST):
- a=BLIST[0]
- b=BLIST[1]
- c=BLIST[2]
- 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:
- mas=line.split()
- for j in range (0,3,1):
- mas[j] = float(mas[j])
- kv(mas)
Add Comment
Please, Sign In to add comment