Compute · Transform · Data & Research
Compute an add-on price as percent-of-base with floor and cap
I give a base ACV, a percentage, a floor and a cap, and get the add-on price = clamp(pct * baseACV, floor, cap), so the add-on scales with customer size but stays bounded.
You receive: A pure function addonPrice(baseACV, pct, floor, cap) -> {raw, applied, boundHit} graded on hidden input->output cases.
Part of Choose Business Model
What's verified: STUD verifies the clamp arithmetic is exact against hidden ACV/percent/floor/cap cases and reports which bound was hit. STUD does NOT verify that the chosen percentage, floor, or cap are the right values, nor that the add-on is worth that price to the customer.
Opens soon
This objective is verified and ready. It opens soon, once sign-in and payments are live.
Deliverable interface
The exact vocabulary the automated check enforces: keys, tokens, entry points, and worked examples. Generated from the verification source.
{
"constants": {},
"entryName": "addon_price",
"expectNote": "expect is the comparison-space value (your return value goes through normalize first when one is published)",
"hiddenCaseCount": 12,
"hiddenCaseNames": [
"cap_binds",
"exactly_floor",
"pct_zero",
"high_pct",
"small_base",
"large_base",
"near_cap",
"near_floor",
"mid",
"low_pct_big",
"invalid_bounds",
"tight_band"
],
"inputKeys": [
"baseACV",
"cap",
"floor",
"pct"
],
"normalizeSource": "def _normalize_compute_percent_of_base_addon_price(r):\n if not isinstance(r, dict): return repr(r)\n def n(x, p): return None if x is None else round(float(x), p)\n return {\"raw\": n(r.get(\"raw\"), 2), \"applied\": n(r.get(\"applied\"), 2), \"boundHit\": r.get(\"boundHit\")}\n",
"returnShapes": [
[
"applied",
"boundHit",
"raw"
]
],
"signature": "def addon_price(inp):",
"submission": "python exposing the entry function; inp is one input object; graded on held-out cases",
"tier": "calculator",
"visibleCases": [
{
"expect": {
"applied": 4000,
"boundHit": "none",
"raw": 4000
},
"input": {
"baseACV": 40000,
"cap": 10000,
"floor": 2000,
"pct": 0.1
},
"name": "book_within"
},
{
"expect": {
"applied": 2000,
"boundHit": "floor",
"raw": 1000
},
"input": {
"baseACV": 10000,
"cap": 10000,
"floor": 2000,
"pct": 0.1
},
"name": "floor_binds"
}
],
"vocabulary": [
"applied",
"baseACV",
"boundHit",
"cap",
"floor",
"invalid_bounds",
"none",
"pct",
"raw"
]
}Get early access to STUD the day it goes live.