Assessment: Turtle Graphics >> Python Basics
turtle-11-1: What are correct ways to tell a turtle named Tex to move forward 20 pixels? Select as many as apply.
- This is a correct way to move a turtle forward.
- You are allowed to write expressions inside of methods, so this is correctly written.
turtle-11-2: Which is the correct way to make a new instance of the Turtle class?
turtle-11-3: What does each instance of the Turtle class represent?
turtle-11-4: Select all of the following things that methods can do:
- Methods can change the value that is associated with an attribute.
- Methods can return values.
- Attributes do not need to be pre-declared; any code can add a new attribute to an instance just by assigning a value to it.
turtle-11-5: For an instance of a class that is assigned to the variable student
, what is the proper way to refer to the title
attribute/instance variable?
turtle-11-6: What is the name of jane’s attribute (not method) that is referred to in the following code?
import turtle
jane = turtle.Turtle()
jane.forward(20)
print(jane.x)
The attribute is
Good work!
turtle-11-7: What are the names of the instances in the following code? Please put one instance per blank space and enter them in the order that the computer would read them.
import turtle
wn = turtle.Screen()
jazz = turtle.Turtle()
jazz.forward(50)
jazz.right(90)
pop = turtle.Turtle()
pop.left(180)
pop.forward(76)
-
Good work!
-
Good work!
-
Good work!