NEW
Font size
WorksheetsCodesters: Python Functions and Indexes
Total questions: 27
Worksheet time: 14mins
How can we debug this code?
Nest the commands inside the panther functions
Nest panther() inside the panther function
Change the sprite's variable name to panther
Delete panther()
How do we debug this code?
Set a new background
Nest line 13 under the function
Use an If Statement on line 12
Change line 13 to: subway_ride()
How do we debug this code?
Change the dogs name to Fido
Rename the function
Un-nest line 22
Tab over line 10
How many times will the function fetch run?
1 Time
2 Times
3 Times
It will not run. There is a bug in the code.
How do we debug this code?
Add a background
Change the sprites name
Nest line 18 under the function
Change the function name
Which function runs first
blast_off
encounter
ship
alien
Which line calls the function that launches the ship
def blast_off()
def encounter()
blast_off()
encounter()
If you want to run the dance function after the blast_off, which line would you use to call the function?
11
28
30
32
How many times will the sway function run?
0
1
2
3
How many times will the two_step function run?
0
1
2
3
What is the name of the function
moon
robot
def
blast off
Which line calls the function
def moon():
stage.set_background("moon")
sprite.say("...blast off"")
moon()
Which line defines the function?
def moon():
stage.set_background("moon")
sprite.say("...blast off"")
moon()
How do you debug this code?
Change the name on the call function
Move snow() to line 14
Tab line 3 over
Add a sprite on line 2
How do you debug this code?
Tab line 10 over
Change the name of the function to dino_band
Un-tab lines 5-7
Set the sprite speed to 7
What is an Index?
How fast your program runs
The name of a list
The number of items in a list
The word we use to talk about position of a value inside of a list
new_pets = ["panther", "pig", "fox", "dinosaur"]
selected_pet = new_pets[ ]
Which number should go inside the index in order to select the dinosaur??
1
2
3
4
new_pets = ["panther", "pig", "fox", "dinosaur"]
selected_pet = new_pets[ ]
Which number should go inside the index in order to select the panther??
1
2
3
0
new_pets = ["panther", "pig", "fox", "dinosaur"]
selected_pet = new_pets[ ]
Which number should go inside the index in order to select the pig??
1
2
3
0
Which pet is currently selected by the index?
panther
pig
fox
dinosaur
If you added a fifth pet to the end of the list, what would its index be?
0
4
5
6
Which image is stored by character_image?
princess2
superhero1
alien1
zombie2
Which index would you use to select princess2?
0
1
2
3
If you changed the index to 3, which image would be stored?
princess2
superhero1
alien1
zombie2
What would happen if you changed the index to 4?
An error message would occur
superhero1 would be stored
alien1 would be stored
zombie2 would be stored
a
b
c
d
a
b
c
d
