Codehs - All Answers Karel Top |top|

# This program builds two towers def start(): # Build the first tower build_tower() # Move to the next spot move() move() # Build the second tower build_tower()

takeBall(); — Instructs Karel to pick up one tennis ball from the current space.

putBall() move() turnLeft() move() putBall() move() putBall() codehs all answers karel top

The programs you have written so far are like a straight-line recipe. Karel performs a set of actions in a fixed order, every single time. But what if Karel needs to make a decision based on his current situation? That is where like if and if/else come in.

This is where students search for answers the most. These problems require for loops and while loops. # This program builds two towers def start():

When you reach Super Karel, you get two new built‑in commands: turnRight(); and turnAround(); . Instead of always using three turnLeft(); commands to turn right, you can now simply call turnRight(); .

Karel must navigate a grid and collect all beepers in a systematic way. But what if Karel needs to make a

public class MoveTennisBallStack extends Karel public void run() moveBallPile(); move();

Alex thought for a moment, then wrote: