Python 6
The instruction to set the position of a turtle object to the center of the screen is ________________
setposition
The __________ method of turtle graphics in Python is used to create a turtle screen of a specific size.
setup
What would the result of the turtle.setup(400, 500) be in turtle graphics? (a) A turtle screen of 400 pixels wide and 500 pixels high would be created. (b) A turtle screen of 500 pixels wide and 400 pixels high would be created. (c) A turtle screen of -400 to 400 pixels wide and -500 to 500 pixels high would be created. (d) A turtle screen of -500 to 500 pixels wide and -400 to 400 pixels high would be created. (e) None of the above
(a) A turtle screen of 400 pixels wide and 500 pixels high would be created.
Which of the following is NOT an example of relative positioning? (a) the_turtle.setposition(100, 100) (b) the_turtle.forward(100) (c) the_turtle.left(90) (e) the_turtle.penup() the_turtle.hideturtle()
(a) the_turtle.setposition(100, 100)
Which of the following returns the reference to the "default" turtle created as a result of a call to the setup method? (a) window.turtle() (b) window.getTurtle() (c) setup.getTurtle() (d) setup.getturtle() (e) turtle.getturtle()
(e) turtle.getturtle()
Give Python code using turtle graphics that draws three squares, one inside of the other as shown below.
import turtle turtle.setup(800,600) window=turtle.Screen() the_turtle=turtle.getturtle() the_turtle.forward(100) the_turtle.left(90) the_turtle.forward(100) the_turtle.left(90) the_turtle.forward(100) the_turtle.left(90) the_turtle.forward(100) the_turtle.left(90) the_turtle.hideturtle() the_turtle.penup() the_turtle.setposition(20,20) the_turtle.showturtle() the_turtle.pendown() the_turtle.forward(60) the_turtle.left(90) the_turtle.forward(60) the_turtle.left(90) the_turtle.forward(60) the_turtle.left(90) the_turtle.forward(60) the_turtle.left(90) the_turtle.hideturtle() the_turtle.penup() the_turtle.setposition(40,40) the_turtle.showturtle() the_turtle.pendown() the_turtle.forward(20) the_turtle.left(90) the_turtle.forward(20) the_turtle.left(90) the_turtle.forward(20) the_turtle.left(90) the_turtle.forward(20)
Give Python code to create a square of size 100 x 100 such that its bottom left corner is positioned at screen location (0, 0). Use relative positioning to do this. (Assume that the turtle screen has been set up, and that there is a turtle named the_turtle to make use of.)
the_turtle.forward(100) the_turtle.left(90) the_turtle.forward(100) the_turtle.left(90) the_turtle.forward(100) the_turtle.left(90) the_turtle.forward(100)
Give Python code to create a square of size 100 x 100 such that its bottom left corner is positioned at screen location (0, 0). Use absolute positioning to do this. (Assume that the turtle screen has been set up, and that there is a turtle named the_turtle to make use of.)
the_turtle.setposition(0,0) the_turtle.setposition(100,0) the_turtle.setposition(100,100) the_turtle.setposition(0,100) the_turtle.setposition(0,0)
True or False? For a turtle screen size of 600 x 800, the coordinates of the top left corner are (-300, 400)
true
True or False? The can be created numerous turtle objects in a given program.
true
True or False? The use of turtle graphics in Python requires that the turtle module be imported
true
True or False? When a turtle is moved to a new position using the setposition method, a line is drawn from its current location to the new location if the turtle is set to be shown (by use of the showturtle method.)
true
The instruction to get the reference to the "default" turtle in turtle graphics is ______
turtle.getturtle()
True or False? A location in the turtle graphics window is indicated by an x and y coordinate value relative to the center of the screen in inches.
false->pixels
