1/8
Flashcards covering the definition and usage of for loops, the range function, and its application in Python graphical outputs.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
for loop
A loop with the count variable built in, used for counting and replacing counting while loops to reduce the likelihood of an infinite loop.
range function
A built-in function in Python that creates and returns a list of numbers.
Conditions for using a for loop
Used instead of a while loop when there is a definite starting and ending point and you know exactly how many times the loop should run.
range(10)
A function call that generates a list of numbers from 0 to 9.
range(30, 35)
A function call that generates the numbers 30,31,32,33, and 34.
range(20, 80, 20)
A function call that generates the sequence 20,40, and 60.
range(100, 50, -10)
A function call that generates the sequence 100,90,80,70, and 60.
draw_text
A method used in simplegui that takes a string, a position tuple, a font size, and a color to display text on a canvas.
color = "rgb(" + str(r) + ", " + str(g) + ", " + str(b) + ")"
A string concatenation method used to dynamically create color values for the draw_text function where r,g, and b are variables representing red, green, and blue components.