#!/usr/bin/python
##file of sanjiaoxing mianjiimport math
a = int(raw_input('please enter side a:')) b = int(raw_input('please enter side b:')) c = int(raw_input('please enter side c:')) if a + b <= c or b + c <= a or a + c <= b: out = str(a)+','+str(b)+','+str(c)+" can't make a triangle" else: p = (a + b + c )/2.0 s =math.sqrt(p * (p - a) * (p - b) * (p - c)) out = "the area of this trangle is%.2f " % s print out使用海伦公式,给初学者参考,我也是初学者......