用户:
LYDP查看:0 回复:0 评论:0 创建时间:2020-05-14T17:24:42
【作品展示】

【作品介绍】
这是一个直角三角形任意边长计算器,有建议敲在评论区哦~~
【作品源代码】
import math
print("这是一个计算直角三角形边长的程序,")
print("你可以用它来计算直角三角形的边长。")
print("那我们开始吧!")
a = int(input("请输入第一条边:"))
b = int(input("请输入第二条边:"))
m = a**2
n = b**2
f2 = m + n
if m>n:
t2=m-n
elif mb:
q=a
p=b
elif b>a:
q=b
p=a
if f == int(f) and t == int(t):
print("第三边是{}或{}".format(int(f), int(t)))
elif f == int(f) and t != int(t) and a < b:
print("第三边是{}或根号{},第二种情况中{}是直角边,{}是斜边".format(int(f), int(t2), int(a), int(b)))
elif f == int(f) and t != int(t) and b < a:
print("第三边是{}或根号{},第二种情况中{}是直角边,{}是斜边".format(int(f), int(t2), int(b), int(a)))
elif t == int(t) and f != int(f) and a < b:
print("第三边是根号{}({}是直角边,{}是斜边)或{}".format(int(f2), int(b), int(a), int(t)))
elif t == int(t) and f != int(f) and b < a:
print("第三边是根号{}({}是直角边,{}是斜边)或{}".format(int(f2), int(a), int(b), int(t)))
elif f != int(f) and t != int(t):
print("第三边是根号{}({}和{}都是直角边)或根号{}({}是斜边,{}是直角边)".format(int(f2), int(q), int(p), int(t2), int(q), int(p)))
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn