Net Promoter Score with a Margin of Error

easy
Unit 8 · Metrics0/3 to milestone

NPS asks "how likely are you to recommend us?" on 0–10. Promoters answer 9–10, detractors 0–6. NPS = %promoters − %detractors (from −100 to 100).

Implement nps(scores) returning (nps, margin) where margin is the 95% margin of error: 1.96×100×p+d−(p−d)2n1.96 \times 100 \times \sqrt{\frac{p + d - (p - d)^2}{n}} with proportions pp and dd.

#metrics#surveys2 visible + 1 hidden tests
solution.py · Python 3.13
Loading editor…
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
Net Promoter Score with a Margin of Error · TechGradify