操作方法
首先打开PYTHON,新建一个空白的PY文档。
这里要判断的三角形类型有三种,不等边三角形,等腰三角形和等边三角形。
先定义三个边都要输入数值。 a = int(input("The length of the side a = ")) b = int(input("The length of the side b = ")) c = int(input("The length of the side c = "))
if a != b and b != c and a != c: print("This is Scalene") elif a == b and b == c: print("This is an Equilateral") else: print("This is Isosceles") 定义每种情况下需要打印什么结果出来。
测试一下不同输入得到的不同结果。
如果输入不是数值将会报错,因为定义变量的时候已经规定要要输入什么了。