代码拉取完成,页面将自动刷新
#This program will return the type of the triangle.
#User has to enter the angles of the triangle in degrees.
def angle_type():
angles = []
myDict = {"All angles are less than 90°.":"Acute Angle Triangle","Has a right angle (90°)":"Right Angle Triangle",
"Has an angle more than 90°":"Obtuse Angle triangle"}
display = input("**************Enter the angles of your triangle to know it's type*********")
angle1 = int(input("Enter angle1 : "))
if(angle1 < 180 and angle1 > 0):
angles.append(angle1)
else:
print("Please enter a value less than 180°")
angle1 = int(input())
angles.append(angle1)
angle2 = int(input("Enter angle2 : "))
if(angle2 < 180 and angle2 > 0):
angles.append(angle2)
else:
print("Please enter a value less than 180°")
angle2 = int(input())
angles.append(angle2)
angle3 = int(input("Enter angle3 : "))
if(angle3 < 180 and angle3 > 0):
angles.append(angle3)
else:
print("Please enter a value less than 180°")
angle3 = int(input())
angles.append(angle3)
sum_of_angles = angle1 + angle2 +angle3
if(sum_of_angles > 180 or sum_of_angles < 180):
print("It is not a triangle!Please enter valid angles.")
return -1
print("You have entered : " +str(angles))
if(angle1 >= 90 or angle2 >= 90 or angle3 >= 90):
print(myDict.get("Has a right angle (90°)"))
elif(angle1 < 90 and angle2 < 90 and angle3 < 90):
print(myDict.get("All angles are less than 90°."))
elif(angle1 > 90 or angle2 > 90 or angle3 > 90):
print(myDict.get("Has an angle more than 90°"))
angle_type()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。