ανανεωμένος κώδικας
import math
x=1
f=open('/home/sairinlote/Desktop/test2.txt')
for line in f:
(a,b,c)=line.split(' ')
a,b,c=float(a),float(b),float(c)
if a+b>c and a+c>b and c+b>a:
s=0.5*(a+b+c)
p=a+b+c
e=math.sqrt(s*(s-a)*(s-b)*(s-c))
a1=0.5*((b*b+c*c)-a*a)/(b*c)
b1=0.5*((a*a+c*c)-b*b)/(a*c)
c1=0.5*((b*b+a*a)-c*c)/(b*a)
af=math.degrees(math.acos(a1))
bf=math.degrees(math.acos(b1))
cf=math.degrees(math.acos(c1))
print '''line %s : To sxima einai trigwno
me gwnies a=%.3f deg, b=%.3f deg, c=%.3f deg,
perimetro:%s m kai emvado:%.6f m^2''' % (x,af,bf,cf,p,e)
x=x+1
elif a==0 or b==0 or c==0:
print 'line %s : Den sximatizetai trigwno me 1 i perissoteres midenikes pleyres' %(x,)
x=x+1
elif a+b==c or a+c==b or b+c==a:
print 'line %s :Sximatizetai trigwno to opoio ekfyllizetai se ey8eia' %(x,)
x=x+1
else:
print 'line %s : Den sximatizetai trigwno' %(x,)
x=x+1