1. 首页
  2. 数据库
  3. 其它
  4. Python3:判断三角形的类型

Python3:判断三角形的类型

上传者: 2020-12-23 03:58:08上传 PDF文件 65.08KB 热度 21次
import math A = input("请输入三角形边长A:") B = input("请输入三角形边长B:") C = input("请输入三角形边长C:") # 以下是判断输入值是否为字符,不是字符再继续执行,是字符则结束程序不再执行 if A.isdigit() and B.isdigit() and C.isdigit(): # 'str.isdigit()'判断某个字符串是数字还是非数字' A = float(A) B = float(B) C = float(C) else: print('输入有误,请检查后重新输入') exit() if A>0 and B>0
下载地址
用户评论