Section 16.9 Mixed Up Code Practice
Try to solve each of the following. Click the Check button to check each solution. You will be told if your solution is too short, has a block in the wrong order, or you are using the wrong block. Some of the problems have an extra block that isn’t needed in the correct solution.
Checkpoint 16.9.1.
The following program segment should draw a red line. The blocks have been mixed up. Drag the blocks from the left and put them in the correct order on the right. Click the Check Me button to check your solution.
from turtle import *
---
from turtle import #paired
---
ani = Turtle()
---
ani.color("red")
---
ani.color(red) #distractor
---
ani.forward(100)
Checkpoint 16.9.2.
The following program segment should draw an equilateral triangle. The blocks have been mixed up. Drag the blocks from the left and put them in the correct order on the right. Click the Check Me button to check your solution.
from turtle import *
---
from Turtle import * #distractor
---
mik = Turtle()
---
mik.left(120)
mik.forward(100)
mik.left(120)
mik.forward(100)
mik.left(120)
mik.forward(100)
---
mik.left(60)
mik.forward(100)
mik.left(60)
mik.forward(100)
mik.left(60)
mik.forward(100) #paired
Checkpoint 16.9.3.
The following program segment should create two turtles, Ari and Chris. Ari should have a pensize of 20 and draw a line to the west, while Chris will have the standard pensize and draw a line to the east. The blocks have been mixed up. Drag the blocks from the left and put them in the correct order on the right. Click the Check Me button to check your solution.
Note that we could do the ari commands either before or after the chris commands. Assume we want to move ari first.
from turtle import *
---
ari = Turtle()
chris = Turtle()
---
ari.pensize(20)
ari.left(180)
ari.forward(100)
---
ari.pensize(20)
ari.forward(100) #paired
---
chris.forward(100)
---
chris.left(90)
chris.forward(100) #paired
Checkpoint 16.9.4.
The following program segment should draw a red line, starting from the postion (10, 30). The blocks have been mixed up. Drag the blocks from the left and put them in the correct order on the right. Click the Check Me button to check your solution.
from turtle import *
---
nic = Turtle()
---
nic.color("red")
---
nic.penup()
---
nic.goto(10,30)
---
nic.goto("10,30") #paired
---
nic.pendown()
---
nic.forward(100)
Checkpoint 16.9.5.
The following program segment should turn turtle Bri south, then draw a green line. The blocks have been mixed up. Drag the blocks from the left and put them in the correct order on the right. Click the Check Me button to check your solution.
from turtle import *
---
bri = Turtle()
---
bri.color("green")
bri.setheading(270)
---
bri.color("green")
bri.setheading(90) #distractor
---
bri.forward(100)
You have attempted
of
activities on this page.