from reportlab.lib.pagesizes import letter from reportlab.lib import colors from reportlab.pdfgen import canvas import os, math

out = "/mnt/data/Math_Kangaroo_Notebook_Worksheet_01.pdf" W, H = letter c = canvas.Canvas(out, pagesize=letter)

NAVY = colors.HexColor("#26354A") BLUE = colors.HexColor("#547FA8") PALE = colors.HexColor("#EAF2F8") RULE = colors.HexColor("#DCE9F2") RED = colors.HexColor("#E5B5B5") GOLD = colors.HexColor("#E7C56F") GREY = colors.HexColor("#65758A")

def bg(page, title, subtitle=""): c.setFillColor(colors.HexColor("#FFFEFA")) c.rect(0, 0, W, H, fill=1, stroke=0) c.setStrokeColor(RULE); c.setLineWidth(.45) for y in range(35, H-115, 22): c.line(30, y, W-30, y) c.setStrokeColor(RED); c.setLineWidth(1) c.line(57, 28, 57, H-28) c.setFillColor(BLUE); c.roundRect(75, H-53, 145, 19, 7, fill=1, stroke=0) c.setFillColor(colors.white); c.setFont("Helvetica-Bold", 8) c.drawCentredString(147.5, H-46, "MATH KANGAROO NOTEBOOK") c.setFillColor(NAVY); c.setFont("Helvetica-Bold", 17) c.drawString(75, H-80, title) c.setFillColor(GREY); c.setFont("Helvetica", 8.5) if subtitle: c.drawString(75, H-96, subtitle) c.setStrokeColor(GOLD); c.setLineWidth(2) c.line(75, H-105, W-40, H-105) c.setFillColor(GREY); c.setFont("Helvetica", 8) c.drawRightString(W-40, 18, f"WORKSHEET 01 • PAGE {page}") c.setFillColor(NAVY)

def t(x, y, s, size=9, bold=False, color=NAVY): c.setFillColor(color); c.setFont("Helvetica-Bold" if bold else "Helvetica", size) c.drawString(x, y, s)

def line(x1,y1,x2,y2,lw=1.7): c.setStrokeColor(NAVY); c.setLineWidth(lw); c.line(x1,y1,x2,y2)

def qhead(y, title, desc): c.setFillColor(PALE); c.roundRect(75, y-5, 490, 20, 5, fill=1, stroke=0) t(86, y+1, title.upper(), 9, True, BLUE) t(86, y-19, desc, 8.5)

def workbox(x,y,w=470,h=42): c.setStrokeColor(colors.HexColor("#B9CBD9")); c.setLineWidth(.8) c.roundRect(x,y-h,w,h,5,fill=0,stroke=1) t(x+8,y-12,"WORKING / EXPLANATION",7,True,GREY)

def cross(cx,cy, vals): line(cx-75,cy-50,cx+75,cy+50) line(cx-75,cy+50,cx+75,cy-50) pos={"NW":(cx-57,cy+18),"NE":(cx+22,cy+18),"SE":(cx+22,cy-30),"SW":(cx-57,cy-30)} for k,v in vals.items(): t(*pos[k],v,8,True)

def parallel(cx,cy, vals): line(cx-110,cy+45,cx+110,cy+45) line(cx-110,cy-45,cx+110,cy-45) line(cx-65,cy-98,cx+65,cy+98) xt=cx-6545/98; xb=cx+6545/98 pos={ "tNW":(xt-46,cy+54),"tNE":(xt+10,cy+54),"tSE":(xt+10,cy+25),"tSW":(xt-46,cy+25), "bNW":(xb-46,cy-25),"bNE":(xb+10,cy-25),"bSE":(xb+10,cy-54),"bSW":(xb-46,cy-54) } for k,v in vals.items(): t(*pos[k],v,7.3,True) t(cx-108,cy+54,"parallel line 1",7,False,GREY) t(cx-108,cy-59,"parallel line 2",7,False,GREY)

def triangle(cx,cy, labels, right=False, iso=False): if right: pts=[(cx-65,cy-35),(cx-65,cy+65),(cx+90,cy-35)] for i,j in [(0,1),(1,2),(2,0)]: line(*pts[i],*pts[j]) line(cx-65,cy-20,cx-50,cy-20,1) line(cx-50,cy-20,cx-50,cy-35,1) t(cx-112,cy+5,labels[0],8,True) t(cx-5,cy+13,labels[1],8,True) t(cx+5,cy-52,labels[2],8,True) else: pts=[(cx-85,cy-45),(cx+85,cy-45),(cx,cy+78)] for i,j in [(0,1),(1,2),(2,0)]: line(*pts[i],*pts[j]) t(cx-80,cy-30,labels[0],8,True) t(cx+34,cy-30,labels[1],8,True) t(cx-22,cy+53,labels[2],8,True) if iso: line(cx-47,cy+10,cx-40,cy+5,1) line(cx+40,cy+5,cx+47,cy+10,1)

def footer_note(s): t(80,34,s,7.5,False,GREY)

Page 1 cover and reference

bg(1,"Advanced Geometry","Angle relationships • algebra • multi-step reasoning") t(80,H-145,"Name: ______________________________________",10) t(80,H-170,"Date: _______________________________________",10) qhead(H-215,"Your mission","Solve each problem using the exact angle positions shown in the diagrams.") t(88,H-263,"Notebook rules",11,True) for i,s in enumerate([ "1. Show your working — answers alone are not enough.", "2. Diagrams are labelled carefully but may not be drawn to scale.", "3. State the angle rule you use when a question asks you to explain.", "4. Complete the package independently; we'll mark it together afterward." ]): t(92,H-286-i22,s,9) qhead(H-395,"Angle-rule reference","Use this reference when solving the questions.") for i,s in enumerate([ "Vertically opposite angles: equal", "Angles on a straight line: add to 180°", "Angles around a point: add to 360°", "Triangle interior angles: add to 180°", "Corresponding / alternate angles: equal when lines are parallel", "Co-interior angles: add to 180° when lines are parallel" ]): t(92,H-430-i21,s,9,True) t(90,H-585,"Target: accuracy first, then elegant reasoning.",11,True,BLUE) c.showPage()

Page 2

bg(2,"Part A — Intersecting lines","Look at the sectors around each intersection.") qhead(H-130,"1. Vertically opposite angles","The expressions are in opposite sectors at the same intersection.") cross(210,H-250,{"NW":"3x + 8°","SE":"5x − 20°","NE":"?","SW":"?"}) t(390,H-220,"a) Find x.",10,True); t(390,H-242,"b) Find all four angles.",10,True) workbox(85,H-330,h=48) qhead(H-405,"2. Adjacent angles on a straight line","The ray splits a straight angle into two adjacent labelled angles.") cx,cy=220,H-530 line(cx-125,cy,cx+125,cy); line(cx,cy,cx+60,cy+92) t(cx-110,cy+14,"4x + 13°",9,True); t(cx+28,cy+14,"7x − 8°",9,True) t(390,H-515,"Find x and both",10,True); t(390,H-532,"angle measures.",10,True) workbox(85,H-640,h=48) c.showPage()

Page 3

bg(3,"Part A — Parallel lines","The horizontal lines are parallel; the slanted line is the transversal.") qhead(H-130,"3. Corresponding angles","Both marked angles occupy the upper-right corner at their intersections.") parallel(225,H-280,{"tNE":"6x − 5°","bNE":"4x + 17°"}) t(410,H-245,"Find x and the",9,True); t(410,H-261,"angle measure.",9,True) workbox(85,H-395,h=45) qhead(H-455,"4. Alternate interior angles","Both marked angles are between the parallel lines, on opposite sides of the transversal.") parallel(225,H-600,{"tSE":"3x + 22°","bNW":"5x − 14°"}) t(410,H-565,"Find x and both",9,True); t(410,H-581,"angle measures.",9,True) c.showPage()

Page 4

bg(4,"Part B — Angle combinations","Identify the location first, then choose the angle relationship.") qhead(H-130,"5. Co-interior angles","Both marked angles lie between the parallel lines and on the same side of the transversal.") parallel(225,H-285,{"tSE":"4x + 10°","bNW":"2x + 20°"}) t(410,H-250,"Find x and each",9,True); t(410,H-266,"angle measure.",9,True) workbox(85,H-400,h=42) qhead(H-455,"6. Triangle angle equation","Each expression labels an interior angle at one vertex of the triangle.") triangle(225,H-595,["2x + 10°","3x − 5°","x + 25°"]) t(410,H-560,"Find x and all",9,True); t(410,H-576,"three angles.",9,True) c.showPage()

Page 5

bg(5,"Part B — Triangle reasoning","Tick marks on the two sloping sides show that those sides are equal.") qhead(H-130,"7. Isosceles triangle","The two base angles are equal. Use the expressions shown at the vertices.") triangle(225,H-285,["3x − 4°","3x − 4°","4x + 8°"],iso=True) t(410,H-245,"Find x and all",9,True); t(410,H-261,"three angles.",9,True) workbox(85,H-395,h=44) qhead(H-455,"8. Right-angled triangle","The small square marks the 90° angle; the other expressions label the acute angles.") triangle(225,H-605,["90°","x + 12°","2x + 6°"],right=True) t(410,H-565,"Find x and the",9,True); t(410,H-581,"two unknown angles.",9,True) c.showPage()

Page 6

bg(6,"Part C — Multi-step reasoning","These questions combine more than one angle fact.") qhead(H-130,"9. Exterior angle of a triangle","The exterior angle is outside the triangle at the right-hand vertex.")

Triangle with right-side extension

pts=[(125,H-320),(285,H-320),(205,H-220)] line(*pts[0],*pts[1]); line(*pts[1],*pts[2]); line(*pts[2],*pts[0]); line(285,H-320,335,H-320) t(112,H-305,"2x + 15°",8,True); t(194,H-235,"3x − 5°",8,True); t(295,H-305,"7x − 10°",8,True) t(385,H-250,"Find x, the exterior",9,True); t(385,H-266,"angle and all three",9,True); t(385,H-282,"interior angles.",9,True) workbox(85,H-385,h=42) qhead(H-445,"10. Intersecting lines in a ratio","The adjacent angles are in the ratio 2 : 7.") cross(210,H-575,{"NW":"2k","SE":"7k","NE":"?","SW":"?"}) t(390,H-545,"Find k and all",9,True); t(390,H-561,"four angles.",9,True) c.showPage()

Page 7

bg(7,"Part D — Challenge set","Read every location and relationship carefully.") qhead(H-130,"11. Triangle angle ratio","The three interior angles of this triangle are in the ratio 2 : 3 : 4.") triangle(220,H-270,["2k","3k","4k"]) t(410,H-235,"Find all three",9,True); t(410,H-251,"interior angles.",9,True) workbox(85,H-380,h=40) qhead(H-440,"12. Quadrilateral reasoning","The expressions label the four interior angles of the quadrilateral.") pts=[(125,H-650),(300,H-650),(275,H-565),(145,H-555)] for i in range(4): line(*pts[i],*pts[(i+1)%4]) t(100,H-635,"2x + 10°",8,True); t(260,H-635,"3x − 20°",8,True) t(275,H-552,"x + 30°",8,True); t(110,H-552,"4x + 20°",8,True) t(385,H-600,"Find x and all",9,True); t(385,H-616,"four interior angles.",9,True) c.showPage()

Page 8

bg(8,"Part D — Final challenge","This final problem uses corresponding and supplementary angles.") qhead(H-130,"13. Parallel lines — angle chase","At the upper intersection, the obtuse angle is labelled. At the lower intersection, the acute angle corresponding to the upper acute angle is labelled.") parallel(255,H-330,{"tNW":"3x + 15°","bNE":"2x + 5°"}) t(90,H-475,"a) Find x.",10,True) t(90,H-500,"b) Calculate the acute angle.",10,True) t(90,H-525,"c) Calculate the obtuse angle.",10,True) t(90,H-550,"d) Explain why your answers are consistent.",10,True) workbox(85,H-590,h=75) t(90,H-700,"Check: the two parallel lines must remain parallel, and each adjacent pair must total 180°.",8,True,BLUE) c.showPage()

Page 9 completion page

bg(9,"Completion & reflection","Finish this page after attempting every question.") qhead(H-130,"Completion checklist","Tick each item when it is done.") for i,s in enumerate([ "I attempted all 13 questions.", "I showed algebra and angle calculations.", "I identified the angle relationship used.", "I checked that triangle angles total 180°.", "I checked that straight-line pairs total 180°." ]): t(100,H-185-i*35,"□ "+s,10) qhead(H-390,"Reflection","Do not solve anything new here — just record your experience.") t(90,H-430,"The question I found most challenging was:",9,True) workbox(90,H-445,h=48,w=450) t(90,H-520,"The angle rule I want to review is:",9,True) workbox(90,H-535,h=48,w=450) t(90,H-610,"One strategy I used successfully was:",9,True) workbox(90,H-625,h=48,w=450) t(90,H-710,"When you're finished, send your answers and working for us to review together.",8.5,True,BLUE) c.save()

print(f"Created: {out} ({os.path.getsize(out)} bytes)")