Three side input triangle, determine whether to form a triangle, and output to judge the results, such as: a right triangle, equilateral triangle, isosceles triangle, triangle commonly,
CodePudding user response:
Algorithm or code? Should go to q&a python code channel Posting, ensure to offer
Algorithm about
Input a, b, c,
Increasing sequence sorting, get l [3]
If l [0] + [1] l & gt; L [2], in order to do the following judgment
The triangle mark='general triangle'
If l [0] [0] + [1] l * l * l [1] [2]=l * l [2], print 'right triangle, the triangle mark='
If l [0]=l [1] [2]=l, print 'an equilateral triangle, triangle mark='
If l [0]=l [1] OR [2] OR [0]=l l l [1] [2]=l, print 'isosceles triangle, triangle mark='
Print the triangle mark
Otherwise print 'is not a triangle'
CodePudding user response:
reference 1/f, old coconut response: algorithm or code? Should go to q&a python code channel Posting, ensure to offer Algorithm about Input a, b, c, Increasing sequence sorting, get l [3] If l [0] + [1] l & gt; L [2], in order to do the following judgment The triangle mark='general triangle' If l [0] [0] + [1] l * l * l [1] [2]=l * l [2], print 'right triangle, the triangle mark=' If l [0]=l [1] [2]=l, print 'an equilateral triangle, triangle mark=' If l [0]=l [1] OR [2] OR [0]=l l l [1] [2]=l, print 'isosceles triangle, triangle mark=' Print the triangle mark Otherwise print 'is not a triangle I want algorithms, the steps and I know that CodePudding user response:
s=filling [3] S.s ort () Print (s) A=s [0] B=s [1] C=s [2] If a + b> C: Print (' composition triangle ') If a b * * * * 2 + 2==c * * 2: Print (' right triangle) If a==b: Print (' isosceles triangle ') If b==c: Print (' an equilateral triangle ') The else: Print (' the triangle ') CodePudding user response:
So!!!! List_1=input (' input, respectively, the length of three sides separated with ", "(middle) : '). The split (', ') List_2=[int (I) for I list_1] in A, b, c=list_2 [0], list_2 [1], list_2 [2] If a + b> C and a - b Print (' can form a triangle! ') If a b * * * * 2 + 2==c * * 2/c * * 2 + 2==b * * * * a 2 b or c * * 2 + 2==a * * * * 2: Print (' the triangle is a right triangle! ') Elif and b=a==b=c: Print (' the triangle is an equilateral triangle! ') Elif a==b or a or b===c=c: Print (' the triangle is isosceles triangle! ') The else: Print (' the triangle is a regular triangle! ') The else: Print (' not form a triangle! ') Results: CodePudding user response:
refer to fifth floor try _except response: this!!!! List_1=input (' input, respectively, the length of three sides separated with ", "(middle) : '). The split (', ') List_2=[int (I) for I list_1] in A, b, c=list_2 [0], list_2 [1], list_2 [2] If a + b> C and a - b Print (' can form a triangle! ') If a b * * * * 2 + 2==c * * 2/c * * 2 + 2==b * * * * a 2 b or c * * 2 + 2==a * * * * 2: Print (' the triangle is a right triangle! ') Elif and b=a==b=c: Print (' the triangle is an equilateral triangle! ') Elif a==b or a or b===c=c: Print (' the triangle is isosceles triangle! ') The else: Print (' the triangle is a regular triangle! ') The else: Print (' not form a triangle! ') Results: The sharp-eyed, your meaning is correct!!!!!! Thank you very much