6.3.5 Cmu Cs Academy May 2026
# 6.3.5 - Moving Circle with Arrow Keys # CMU CS Academy Solution circle = None
def onKeyPress(key): global circle # Movement speed speed = 15 6.3.5 Cmu Cs Academy
def onAppStart(app): global circle # Create blue circle at center of 400x400 canvas circle = Circle(200, 200, 20, fill='blue') # Add it to the canvas add(circle) It uses a custom, simplified version of Python
This article will break down exactly what 6.3.5 requires, the core concepts you need to master, common pitfalls, and a step-by-step strategy to solve it efficiently. Before we dissect the specific exercise, let's establish the platform. CMU CS Academy is a free, online, project-based curriculum developed by Carnegie Mellon University. It uses a custom, simplified version of Python (built around the cmu_graphics library) to teach computer science fundamentals through visual, interactive graphics. Common Mistakes on 6
The boundary check uses 20 and 380 because the radius is 20. The center of a 20px radius circle at x=20 touches the edge at x=0. Common Mistakes on 6.3.5 Even smart students fail 6.3.5 on the first try. Here is why: Mistake #1: Forgetting global 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. Mistake #2: Using the Wrong Key Strings Many students try:
def onKeyPress(key): circle.centerX += 15 # Error: circle is not defined