Problems › Python › production
Overall equipment effectiveness
OEE multiplies three percentages together into one number that plant managers compare across lines.
- Availability, performance and quality are each a percentage from 0 to 100.
- The score is the three multiplied and brought back to a percentage, rounded half up.
- Anything outside 0 to 100 is clamped into range before the sum.
oee_score(availability: int, performance: int, quality: int) → int
Where you start
def oee_score(availability: int, performance: int, quality: int) -> int:
Worked examples
| Call | Result |
|---|---|
oee_score(90, 95, 99) | 85 |
oee_score(100, 100, 100) | 100 |
oee_score(0, 100, 100) | 0 |
oee_score(150, 100, 100) | 100 |
Hint
Clamp all three first, then multiply and divide by 10000 — adding 5000 before the divide rounds it.
Reference solution in Python
def oee_score(availability: int, performance: int, quality: int) -> int:
def c(v):
return max(0, min(100, v))
n = c(availability) * c(performance) * c(quality)
return (n + 5000) // 10000