如题所述
# 面积:
# 设等腰梯形的上底为a,下底为b,高为h,则面积S=(a+b)*h/2
# Python代码:
a = float(input("请输入上底:"))
b = float(input("请输入下底:"))
h = float(input("请输入高:"))
S = (a + b) * h / 2
print("等腰梯形的面积为:", S)
# 周长:
# 设等腰梯形的上底为a,下底为b,斜边为c,则周长P=a+b+2*c
# Python代码:
a = float(input("请输入上底:"))
b = float(input("请输入下底:"))
c = float(input("请输入斜边:"))
P = a + b + 2 * c
print("等腰梯形的周长为:", P)
解题思路
温馨提示:答案为网友推荐,仅供参考