What is the purpose of the onStep function?

Understanding Event Functions and onStep in Python

Flashcard
•
Computers
•
9th Grade
•
Hard
Quizizz Content
FREE Resource
Student preview

8 questions
Show all answers
1.
FLASHCARD QUESTION
Front
Back
To execute code once per second as defined by app.stepsPerSecond.
2.
FLASHCARD QUESTION
Front
How many times does onStep run if app.stepsPerSecond is set to 1? Options: Once per minute, Once per second, Twice per second, Ten times per second
Back
Once per second
3.
FLASHCARD QUESTION
Front
What data is accessible locally inside the function's implementation of def onMouseRelease(mouseX, mouseY):
?
Back
mouseX, mouseY
4.
FLASHCARD QUESTION
Front
In python, which method is called to add data to the end of a list?
Back
append
5.
FLASHCARD QUESTION
Front
What is the meaning of the term mutability in computer programming?
Back
Mutability is the ability of an object to be changed after its creation.
6.
FLASHCARD QUESTION
Front
In your CMU CS Academy App, you have declared a python list named app.shapes. Each time the onStep function triggers, you want to traverse the entire list of shapes. What code would you write to make this happen? Options: while shape in app.shapes:, for shape in app.shapes: # perform actions with shape, foreach shape in app.shapes:, for shape in app.shapes()
Back
for shape in app.shapes:
# perform actions with shape
7.
FLASHCARD QUESTION
Front
what does it mean to traverse a data structure such as a python list?
Back
To traverse a Python list means to access each element in the list sequentially.
8.
FLASHCARD QUESTION
Front
You are creating a painting app in CMU CS Academy using Python. You want your app to have the ability for the user to set different modes like draw, change, move, and delete for objects on the canvas. You need to implement code in your onStep function to test which mode the user has selected. What code would you write given the 4 selections listed above?
Back
if mode == 'draw':
# code to draw
elif mode == 'change':
# code to change
elif mode == 'move':
# code to move
elif mode == 'delete':
# code to delete
Similar Resources on Quizizz
9 questions
What App?

Flashcard
•
8th Grade
8 questions
Getting started with Python: Memory & Variable

Flashcard
•
7th Grade
8 questions
Python

Flashcard
•
KG - 9th Grade
10 questions
Python Loops Flashcard

Flashcard
•
10th Grade
10 questions
Le stringhe di Python

Flashcard
•
8th Grade
10 questions
Python Data Structures

Flashcard
•
10th Grade
10 questions
Python

Flashcard
•
7th - 8th Grade
9 questions
What App?

Flashcard
•
8th Grade
Popular Resources on Quizizz
15 questions
Multiplication Facts

Quiz
•
4th Grade
20 questions
Math Review - Grade 6

Quiz
•
6th Grade
20 questions
math review

Quiz
•
4th Grade
5 questions
capitalization in sentences

Quiz
•
5th - 8th Grade
10 questions
Juneteenth History and Significance

Interactive video
•
5th - 8th Grade
15 questions
Adding and Subtracting Fractions

Quiz
•
5th Grade
10 questions
R2H Day One Internship Expectation Review Guidelines

Quiz
•
Professional Development
12 questions
Dividing Fractions

Quiz
•
6th Grade
Discover more resources for Computers
25 questions
Spanish preterite verbs (irregular/changed)

Quiz
•
9th - 10th Grade
10 questions
Identify Slope and y-intercept (from equation)

Quiz
•
8th - 9th Grade
10 questions
Juneteenth: History and Significance

Interactive video
•
7th - 12th Grade
8 questions
"Keeping the City of Venice Afloat" - STAAR Bootcamp, Day 1

Quiz
•
9th - 12th Grade
26 questions
June 19th

Quiz
•
4th - 9th Grade
27 questions
STAAR English 1 Review

Quiz
•
9th Grade
20 questions
Understanding Linear Equations and Slopes

Quiz
•
9th - 12th Grade