Classifying Bracing Frames
Problem
A workshop builds triangular bracing frames from three steel struts. The `braces` DataFrame stores one frame per row with the three strut lengths `side_x`, `side_y`, and `side_z` in centimeters. Three lengths only form a real triangle when every side is shorter than the sum of the other two; if any side is greater than or equal to that sum, the struts cannot close into a triangle.
For each frame return a single column `frame_kind`:
- `Open Frame` if the three struts cannot form a triangle.
- `Regular` if all three struts are equal.
- `Balanced` if exactly two struts are equal.
- `Irregular` if all three struts differ.
Return one row per frame in any order.
Input data
Example rows — the live problem includes the full dataset.
| side_x | side_y | side_z |
|---|---|---|
| 15 | 15 | 18 |
| 15 | 15 | 15 |
| 15 | 16 | 17 |
| 8 | 9 | 25 |
Expected output
Your answer should return 4 rows with the columns frame_kind.
Starter code (Pandas (Python))
import pandas as pd
def classify_braces(braces) -> pd.DataFrame:
# Your code here
return bracesSolve this Pandas question free
Write Pandas (Python) and run it instantly in your browser — even on your phone. No signup needed to try.
Solution & explanation
Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.
Sign up free to unlock