WorksheetsPython_Unit 6 Graphics Review (6.1-6.6)
Total questions: 20
Worksheet time: 11mins
What is a set of commands that work together to complete a similar goal/task?
module
function
def
for loop
We use FOR loops instead of WHILE loops when:
(select all)
You do not know how many times you want the loop to run
You know how many times you want the loop to run
When you need to ask the user for input
When there is a definite starting and ending point
____, _____,______, are used for color
Red, Green, Blue
Red, Orange, Blue
Black, White, Yellow
Blue, Green, Red
What type of color code is this?
#AE7DFF
RGB
Hexadecimal
HTML
CSS
Color codes are stored as ______.
Hint:
randRGBColor = "RGB( " + "30" + "," + str(g) + "," + "255"+ ")"
Integers
Decimals (Floats)
Strings
Real Data
Where do X,Y coordinates begin in Python?
upper left hand corner
center of screen
upper right hand corner
lower right hadn corner
What does this line of code do?
import simplegui
Brings in the simplegui functions
Imports the for function
Draws a box
Imports simple stuff
Consider this code: Which variable sets up the space to draw?
import simplegui
def draw_handler(canvas):
canvas.draw_text("Coding Rocks!", (50, 50), 20, "Aqua")
frame = simplegui.create_frame("Home",800,800)
frame.set_draw_handler(draw_handler)
frame.start()
canvas.draw
frame=simplegui.create_frame
"Aqua"
import simplegui
Which function will draw shapes?
random.randint
draw_polygon
draw_line
draw_text
The order of drawing parameters when coding Python are...?
width, (x,y), color
(x,y), width, color
color, (x,y), width
(x,y), color, width
What does 800,800 represent?
frame = simplegui.create_frame("Home", 800, 800)
the location of the frame
the size of the frame
the color of the frame
the range of the frame
How many times does this loop run?
for r in range (80):
79 (zero to seventy-eight)
80 (zero to seventy-nine)
81 (zero to eighty)
80 (one to seventy-nine)
For graphics to work, the following command is necessary.
frame.set_canvas_background("White")
import simplegui
import random
x = random.randint(100, 150)
Which function would you use to draw a circle?
draw_point
draw_polygon
draw_circle
draw_text
What does the 100 represent?
canvas.draw_text(“Hello”, (50,100), 8, “blue”)
x location
y location
size
color
What does the 80 represent?
canvas.draw_point( [80,100], “yellow”)
x location
y location
color
size
What color is the inside of the circle?
canvas.draw_circle((200,210), 100, 3, "Green","Yellow")
Green
Yellow
What numbers will the for loop run through?
for x in range(8)
[0,1,2,3,4,5,6,7]
[0,1,2,3,4,5,6,7,8]
[1,2,3,4,5,6,7]
[-0,1,2,3,4,5,6,7,8]
What numbers will the for loop run through?
for r in range(3, 9)
[3,4,5,6,7,8,9]
[3,4,5,6,7,8]
[0,1,2,3,4,5,6,7,8]
[1,2,3,4,5,6,7,8]
What do 400 and 600 represent?
simplegui.create_frame( “Main”, 400, 600)
color of the frame
size of the frame
location of the frame
movement of frame
