6.3.5 Cmu Cs Academy «FULL — 2024»
The onKeyPress(key) function receives a string argument. For arrow keys, the strings are:
Error: Writing if r % 2 == 0 and c % 2 == 0 but forgetting the mixed parity cells.
Result: Only corners or specific cells become red; the rest are incorrect.
Fix: Use the (r + c) % 2 == 0 pattern—it's mathematically robust for alternating checks.
Topic 6.3 introduces while loops in the context of graphical animation. By 6.3.5, students have already learned: 6.3.5 Cmu Cs Academy
Specific Goals of 6.3.5:
Every time you modify circle inside onKeyPress, you must write global circle. If you forget, Python creates a local variable named circle, and the actual circle on screen never moves. The onKeyPress(key) function receives a string argument
from cmu_graphics import *
circle = Circle(50, 200, 20, fill='blue')
def moveUntilLimit():
global circle
while circle.centerX < 300:
circle.centerX += 1
# Need a short pause to see animation?
# But wait – direct while in graphics will freeze unless stepped. Specific Goals of 6
Carnegie Mellon University's CS Academy (CMU CS Academy) has rapidly become one of the most respected free online computer science curricula for high school and middle school students. Unlike traditional introductory programming courses that rely on text-based console outputs, CMU CS Academy uses a graphics-first approach based on Python. Students learn to code by creating visual shapes, animations, and interactive games using the CMU Graphics package.
The course is divided into units, each with a series of exercises, checkpoints, and creative tasks. One particular checkpoint that often intrigues and challenges students is 6.3.5.
If you’ve searched for "6.3.5 CMU CS Academy," you are likely working through Unit 6, which focuses on Lists and Loops (specifically nested loops and 2D lists). This article will break down what 6.3.5 entails, how to approach it conceptually, the common pitfalls, and how to verify your solution.
For each row, the inner loop iterates over each column number from 0 to cols - 1. Inside, we check if (r + c) % 2 == 0 to decide the color.
for c in range(cols):
if (r + c) % 2 == 0:
new_row.append('red')
else:
new_row.append('blue')