割り当ては、三角形を作成できるコードを作成することです (正三角形の場合は、周囲、面積、右などを見つけます)。
私のコードは目標どおりだと思いますが、数値が三角形を形成しない場合のようにエラーを表示しません。どんな助けでも大歓迎です。
import math
A = int (input ("Type in your first integer that you would like to test:"))
print ("Your first integer to be tested is:", A)
B = int (input ("Type in your second integer that you would like to test:"))
print ("Your second integer to be tested is:", B)
C = int (input ("Type in your third integer that you would like to test:"))
print ("Your third integer to be tested is:", C)
if (A > B):
largest = A
else:
largest = B
if (C > largest):
largest = C
print ("The largest number is:", largest)
if A<=0 or B<=0 or C<=0:
print("The numbers don't form a triangle")
else:
print("The Triangle's Perimeter is:")
print(int(A+B+C))
print("The semiperimeter is:")
print(int((A+B+C)/2))
print("The Area of the triangle is:")
print (int (math.sqrt((A+B+C)/2)*(((A+B+C)/2)-A)*(((A+B+C)/2)-B)*(((A+B+C)/2)-C)))
if int(A != B and A != C and B != C):
print("The triangle is a scalene")
else:
print ("The triangle is not a scalene")
if int(A == B and B == A or A == C and C == A or C == B and B == C):
print ("The triangle is an isosceles")
else:
print ("The triangle is not an isosceles")
if int(A == B == C):
print("The triangle is an equilateral")
else:
print("The triangle is not an equilateral")
if int(C*C == A*A + B*B):
print("The triangle is a right triangle")
else:
print("The triangle is not a right triangle")