CMU CS Academy
Complete Answer Key — Units 1–5 | 2024/2025 | 100% Verified
Comprehensive answer key and study guide for Carnegie Mellon University's CS Academy covering all key
concepts, vocabulary terms, code solutions, and quiz answers for Units 1–5. Topics include shapes & graphics,
functions & parameters, conditionals, events, variables, loops, and more.
# Unit / Topic # Unit / Topic
1 Unit 1 — Shapes, Canvas & Graphics 2 Unit 1 — Shape Properties & Colors
3 Unit 2 — Functions: Key Vocabulary 4 Unit 2 — Functions: Code Examples
5 Unit 2 — Mouse Events & onMousePress 6 Unit 3 — Conditionals (if/elif/else)
7 Unit 3 — Helper Functions 8 Unit 4 — Variables & Global State
9 Unit 4 — Boolean & Comparison Ops 10 Unit 5 — Loops (for loops)
11 Unit 5 — Groups & Looping Through 12 Code Exercise Solutions (2.1.3, etc.)
13 Naming Rules & Best Practices 14 Quick Reference — All Key Terms
Unit 1: Shapes, Canvas & Graphics
Q: What are the dimensions of the CMU CS Academy canvas?
✔ The canvas is 400 × 400 pixels. The coordinate system starts at (0, 0) in the TOP-LEFT corner. X increases
to the RIGHT; Y increases DOWNWARD.
Shape / Function Syntax Key Parameters
Rectangle Rect(x, y, width, height) x/y = top-left corner; width & height in pixels
Circle Circle(cx, cy, radius) cx/cy = center point; radius
Oval Oval(cx, cy, width, height) cx/cy = center; width & height
Line Line(x1, y1, x2, y2) two endpoint coordinates
Polygon Polygon(x1,y1, x2,y2, ...) list of (x,y) vertex pairs
RegularPolygon RegularPolygon(cx,cy,radius,sides) center, radius, number of sides
Star Star(cx, cy, radius, points) center, outer radius, number of points
Label Label('text', cx, cy) text string, center x/y
Arc Arc(cx,cy,w,h,startAngle,sweepAngle) portion of an oval; angles in degrees
Arrow Arrow(x1,y1,x2,y2) line with arrowhead at endpoint 2
Image Image(url, cx, cy) image URL and center position
Unit 1: Shape Properties, Colors & Styling
Q: How do you set the fill color of a shape?
✔ Use the fill= property. Example: Circle(200, 200, 50, fill='red')
You can use color names ('gold', 'skyBlue') or rgb() values.
# Named color
Circle(200, 200, 50, fill='tomato')
# RGB color (red=255, green=165, blue=0 = orange)
Rect(50, 50, 100, 60, fill=rgb(255, 165, 0))