Chapter 3 Flashcards
(24 cards)
What is iteration?
Repeating steps using loops
What is an indefinite loop?
A loop that keeps going until a condition is false
What is a definite loop?
A loop that runs a set number of times
What does a while loop do?
Repeats while a condition is true
What does a for loop do?
Repeats a set number of times
What can cause an infinite loop?
The loop’s condition is always true
What is a list?
A group of items saved together
Where does indexing start on the AP test?
It starts at 1
Where does indexing start in Python?
It starts at 0
What does append() do to a list?
Adds something to the end
What does insert() do to a list?
Adds something at a certain spot
What does pop() do to a list?
Removes something from the list
What does len() tell you about a list?
The number of items in it
What is list slicing?
Getting a part of a list
What is a list traversal?
Going through a list one item at a time
How do you print all items in a list?
Use a loop
How do you print every other item in a list?
Use a loop that skips by 2
How do you print a list backwards?
Loop from the end to the start
How do you add all numbers in a list?
Use a loop to add them
How do you find the smallest number in a list?
Use a loop to check each one
How do you find the biggest number in a list?
Use a loop to compare each
How do you count how many numbers are negative?
Use a loop and count if less than 0
How do you remove vowels from a word using loops?
Skip each letter that is a vowel
How do you find where a value is in a list?
Loop and check the index