Triangle Type
Given three sides, you can tell what kind of triangle they form, or whether a triangle is impossible. The function triangle_kind receives side lengths a, b, and c, then returns equilateral, isosceles, scalene, or invalid. Remember the key rule: the sum of any two sides must be greater than the third side.
Примеры
Ввод
(2, 2, 2)Вывод
"equilateral"Ввод
(3, 4, 4)Вывод
"isosceles"Ввод
(3, 4, 5)Вывод
"scalene"Нужно реализовать
def triangle_kind(a: float, b: float, c: float) -> str:
Теги
math
Accedi per vedere la cronologia degli invii
AccediAccedi per usare l'AI Mentor
AccediVisible tests
1
Input
2, 2, 2Expected
"equilateral"2
Input
3, 4, 4Expected
"isosceles"3
Input
3, 4, 5Expected
"scalene"4
Input
1, 1, 3Expected
"invalid"5
Input
0, 0, 0Expected
"invalid"6
Input
7, 3, 2Expected
"invalid"Focus radio
Paused · SomaFM · Fluid