import math
a = float(input(f"请输入三角形的第1边长:"))
b = float(input(f"请输入三角形的第2边长:"))
c = float(input(f"请输入三角形的第3边长:"))
# l=(a+b+c)/2
if a+b>c:
l = a + b + c / 2
s = math.sqrt((l * (l - a) * (l - c) * (l - c)))
print(f'该三角形面积为:{round(s, 1)}')
有帮助请采纳,有问题继续交流,你的采纳是对我回答的最大的肯定和动力
s = input(' ')
[a,b,c] = [int(i) for i in s.split(' ')]
p = 0.5 * (a+b+c)
area = (p * (p-a) * (p-b) * (p-c)) ** (0.5)
round(area, 1)
a = int(input('请输入三角形的第一个边长:'))
b = int(input('请输入三角形的第二个边长:'))
c = int(input('请输入三角形的第三个边长:'))
l = (a+b+c)/2
squ = (l*(l-a)*(l-b)*(l-c))**0.5
print('三角形的面积为:',squ)
math可用:
import math
a = int(input('请输入三角形的第一个边长:'))
b = int(input('请输入三角形的第二个边长:'))
c = int(input('请输入三角形的第三个边长:'))
l = (a+b+c)/2
# squ = (l*(l-a)*(l-b)*(l-c))**0.5
# print('三角形的面积为:',squ)
s = math.sqrt(l*(l-a)*(l-b)*(l-c))
print('三角形的面积为:',s)