我是靠谱客的博主 迷路爆米花,这篇文章主要介绍浙大Python 第2章-12 输出三角形面积和周长 (15 分),现在分享给大家,希望可以做个参考。

专题博客链接

[题解]浙大Python PTA课后习题博客记录(Python)



原题题目

在这里插入图片描述



代码实现

复制代码
1
2
3
4
5
6
7
8
import math a,b,c = map(int,input().split()) s = (a+b+c)/2 if(a+b>c and b+c>a and a+c>b): print("area = {0:.2f}; perimeter = {1:.2f}".format(math.sqrt(s * (s-a) * (s-b) * (s-c)),2*s)) else: print("These sides do not correspond to a valid triangle")


提交结果

在这里插入图片描述

最后

以上就是迷路爆米花最近收集整理的关于浙大Python 第2章-12 输出三角形面积和周长 (15 分)的全部内容,更多相关浙大Python内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(110)

评论列表共有 0 条评论

立即
投稿
返回
顶部