This project implements a function that sorts packages in a robotic automation factory.
sort(width, height, length, mass)
- Dimensions are in centimeters
- Mass is in kilograms
- Returns:
"STANDARD","SPECIAL", or"REJECTED"
A package is:
Bulky if:
- Volume (width × height × length) ≥ 1,000,000 cm³
- OR any dimension ≥ 150 cm
Heavy if:
- Mass ≥ 20 kg
- Not bulky and not heavy → STANDARD
- Bulky or heavy → SPECIAL
- Bulky and heavy → REJECTED
def sort(width, height, length, mass):
volume = width * height * length
bulky = (
volume >= 1_000_000 or
width >= 150 or
height >= 150 or
length >= 150
)
heavy = mass >= 20
if bulky and heavy:
return "REJECTED"
if bulky or heavy:
return "SPECIAL"
return "STANDARD"print(sort(100, 100, 100, 10)) # STANDARD
print(sort(200, 50, 50, 10)) # SPECIAL
print(sort(200, 200, 200, 25)) # REJECTED