Sign InCoursewareNuggetsTutorials CoursesCodePad

Drawing Balloons, Lots of Balloons

"The red balloon is so beautiful! Can we draw more?" Tali asks Andrew. "Sure thing!" Andrew starts to draw more red circles. Although they don't exactly look like balloons, they are pretty fun to draw.

import turtle turtle.Screen().setup(800,120) crush = turtle.Turtle() crush.color("red") crush.begin_fill() crush.circle(30) crush.forward(80) crush.circle(30) crush.forward(80) crush.circle(30) crush.forward(80) crush.circle(30) crush.forward(80) crush.circle(30) crush.end_fill()

"Can you change them to blue and make them smaller?" asks Tali. Before Andrew starts to draw, help him change the color to "blue", the radius to 20 for all five circles, and the space between the circles to 70:

crush.color("red")  ==> crush.color("blue")  
crush.circle(30) ==> crush.circle(20)
crush.forward(80) ==> crush.forward(70)

After you are done, hit the run button again. If you see five smaller blue circles, good job! But you had to change all the 30s into 20s and all the 80s into 70s. Don't you wish it could be less tedious?

© CS Wonders·About·Gallery·Fun Facts·Cheatsheet