{"slug":"z-score","tier":1,"subject":"statistics","title":"Z-Score","description":"Standardized z-score z=(x-mu)/sigma.","files":[{"filename":"ZSCORE.py","content":"def p(s):print(s)\ndef o1():\n p(\"=Z-SCORE=\")\n x=float(input(\"x:\"))\n m=float(input(\"mu:\"))\n s=float(input(\"sd:\"))\n z=(x-m)/s\n p(\"z=\"+str(z))\ndef menu():\n while True:\n  p(\"=ZSCORE=\")\n  p(\"1:Z\")\n  p(\"0:EXIT\")\n  c=input(\"?>\")\n  if c==\"1\":o1()\n  elif c==\"0\":break\nmenu()"}],"testCases":[{"id":"x85-mu75-sd5","inputs":["1","85","75","5","0"],"expectedContains":["z=2.0"]},{"id":"x50-mu60-sd10","inputs":["1","50","60","10","0"],"expectedContains":["z=-1.0"]}],"usage":"Computes the standardized z-score `z = (x − μ) / σ`.\n\nLaunch `ZSCORE` from `prgm`, choose `1:Z`, then:\n\n1. `x:` — the raw data value.\n2. `mu:` — population mean μ.\n3. `sd:` — population standard deviation σ (NOT sample SD; use that only if σ is unknown and you have large n).\n\nOutput is `z=`. Positive means above the mean; negative means below.","example":{"problem":"You scored 85 on an exam where the class mean was 75 with a standard deviation of 5. How many SDs above average did you score?","walkthrough":"1. Run `ZSCORE`, choose `1:Z`.\n2. `x:` → **85**, `mu:` → **75**, `sd:` → **5**.\n3. Output: `z=2.0`.\n\nYou scored exactly 2 standard deviations above the mean. Using a z-table, that's roughly the 97.7th percentile. ✓"}}