{"slug":"slope-intercept","tier":1,"subject":"algebra","title":"Slope-Int Ref","description":"Reference card for slope and intercept formulas.","files":[{"filename":"SLOPEINT.py","content":"def p(s):print(s)\ndef o1():\n p(\"=SLOPE=\")\n p(\"m=\")\n p(\"(y2-y1)\")\n p(\"/(x2-x1)\")\ndef o2():\n p(\"=Y-INT=\")\n p(\"y=mx+b\")\n p(\"b=y-mx\")\n p(\"USE ANY PT\")\ndef o3():\n p(\"=PAR/PERP=\")\n p(\"PARALLEL:\")\n p(\"m1=m2\")\n p(\"PERP:\")\n p(\"m1*m2=-1\")\ndef menu():\n while True:\n  p(\"=SLOPE-INT=\")\n  p(\"1:SLOPE\")\n  p(\"2:Y-INT\")\n  p(\"3:PAR/PERP\")\n  p(\"0:EXIT\")\n  c=input(\"?>\")\n  if c==\"1\":o1()\n  elif c==\"2\":o2()\n  elif c==\"3\":o3()\n  elif c==\"0\":break\nmenu()"}],"testCases":[{"id":"slope-formula","inputs":["1","0"],"expectedContains":["y2-y1"]},{"id":"par-perp","inputs":["3","0"],"expectedContains":["PARALLEL"]}],"usage":"Reference card for the three slope/intercept relationships you use constantly in Algebra I/II.\n\n- `1:SLOPE` — the slope formula `m = (y2−y1)/(x2−x1)`.\n- `2:Y-INT` — solve `y=mx+b` for `b` using any point on the line: `b = y − mx`.\n- `3:PAR/PERP` — parallel lines have equal slopes; perpendicular slopes multiply to −1.\n- `0:EXIT` — leave.","example":{"problem":"Line A has slope 2. You need the slope of a line perpendicular to A but you forget the rule.","walkthrough":"1. Run `SLOPEINT`.\n2. Pick `3:PAR/PERP`.\n3. Screen shows: `PERP:` `m1*m2=-1`.\n\nSolve: m1 · m2 = −1, so m2 = −1/m1 = −1/2. The perpendicular line has slope −½. ✓"}}