{"slug":"factor-quadratic","tier":1,"subject":"algebra","title":"Factor Quad Ref","description":"Reference card for quadratic factoring rules.","files":[{"filename":"FACTQUAD.py","content":"def p(s):print(s)\ndef o1():\n p(\"=DIFF SQR=\")\n p(\"a2-b2\")\n p(\"=(a-b)(a+b)\")\ndef o2():\n p(\"=PERF SQR=\")\n p(\"a2+2ab+b2\")\n p(\"=(a+b)^2\")\n p(\"a2-2ab+b2\")\n p(\"=(a-b)^2\")\ndef o3():\n p(\"=AC METH=\")\n p(\"ax2+bx+c\")\n p(\"find m,n:\")\n p(\"m*n=a*c\")\n p(\"m+n=b\")\ndef menu():\n while True:\n  p(\"=FACT QUAD=\")\n  p(\"1:DIFF SQR\")\n  p(\"2:PERF SQR\")\n  p(\"3:AC METH\")\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":"diff-squares","inputs":["1","0"],"expectedContains":["a2-b2"]},{"id":"perf-squares","inputs":["2","0"],"expectedContains":["a2+2ab"]}],"usage":"This is a reference card — no math inputs, just factoring patterns on screen.\n\nLaunch `FACTQUAD` from `prgm`. Pick a pattern from the main menu:\n\n- `1:DIFF SQR` — difference of squares.\n- `2:PERF SQR` — perfect-square trinomials.\n- `3:AC METH` — the AC method for `ax²+bx+c` when `a ≠ 1`.\n- `0:EXIT` — leave the program.\n\nEach pattern prints the recipe in 3–4 lines, then returns to the menu.","example":{"problem":"You're factoring `x² − 9` on a quiz and can't remember the shortcut.","walkthrough":"1. Run `FACTQUAD`.\n2. Pick `1:DIFF SQR`.\n3. Screen shows: `a2-b2` `=(a-b)(a+b)`.\n\nApply with a=x, b=3: `x² − 9 = (x−3)(x+3)`. ✓"}}