Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

Package Sorting System

This project implements a function that sorts packages in a robotic automation factory.

Function

sort(width, height, length, mass)

  • Dimensions are in centimeters
  • Mass is in kilograms
  • Returns: "STANDARD", "SPECIAL", or "REJECTED"

Rules

A package is:

Bulky if:

  • Volume (width × height × length) ≥ 1,000,000 cm³
  • OR any dimension ≥ 150 cm

Heavy if:

  • Mass ≥ 20 kg

Sorting Logic

  • Not bulky and not heavy → STANDARD
  • Bulky or heavy → SPECIAL
  • Bulky and heavy → REJECTED

Implementation (Python)

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"

Example

print(sort(100, 100, 100, 10))  # STANDARD
print(sort(200, 50, 50, 10))    # SPECIAL
print(sort(200, 200, 200, 25))  # REJECTED

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages