Calculate · Assess & Decide · Analysis & Finance
Net Promoter Score
A correct NPS from raw 0-10 responses, with the promoter/passive/detractor breakdown.
You receive: A reviewed NPS calculator + the passing test report, run on your responses.
Part of Choose Business Model
Opens soon
Cost15 credits
AcceptanceAutomated check against your inputs
ProtectionHeld until verified delivery
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": "compute_nps",
"expectNote": "expect is the comparison-space value (your return value goes through normalize first when one is published)",
"hiddenCaseCount": 6,
"hiddenCaseNames": [
"all_detractors",
"realistic",
"out_of_range_excluded",
"fail_mode_invalid",
"single_passive",
"empty"
],
"inputKeys": [
"exclude_out_of_range",
"responses"
],
"normalizeSource": "def _nps_normalize(r):\n try:\n if not r.get(\"valid\", False):\n return {\"valid\": False}\n c = r.get(\"counts\", {}) or {}\n return {\"valid\": True, \"n\": int(r[\"n\"]), \"nps\": int(round(float(r[\"nps\"]))),\n \"det\": int(r.get(\"det\", c.get(\"detractors\"))), \"pas\": int(r.get(\"pas\", c.get(\"passives\"))),\n \"pro\": int(r.get(\"pro\", c.get(\"promoters\")))}\n except Exception:\n return repr(r)\n",
"returnShapes": [
[
"det",
"n",
"nps",
"pas",
"pro",
"valid"
],
[
"valid"
]
],
"signature": "def compute_nps(inp):",
"submission": "python exposing the entry function; inp is one input object; graded on held-out cases",
"tier": "calculator",
"visibleCases": [
{
"expect": {
"det": 0,
"n": 5,
"nps": 100,
"pas": 0,
"pro": 5,
"valid": true
},
"input": {
"responses": "10,10,9,9,9"
},
"name": "all_promoters"
},
{
"expect": {
"det": 2,
"n": 6,
"nps": 0,
"pas": 2,
"pro": 2,
"valid": true
},
"input": {
"responses": "9,9,8,7,6,0"
},
"name": "balanced_zero"
}
],
"vocabulary": [
",",
";",
"det",
"exclude",
"exclude_out_of_range",
"fail",
"n",
"nps",
"pas",
"pro",
"responses",
"valid"
]
}Example
A sample of what this objective produces. Your result is generated for your inputs.
Nps
30
Responses counted
120
Excluded
2
Breakdown
Promoters60
Passives36
Detractors24
Percentages
Promoters pct50
Passives pct30
Detractors pct20
Note
NPS is the promoter percentage minus the detractor percentage (50 minus 20).
Get early access to STUD the day it goes live.