1/29
God bless yall; I pray you pass
A for loop can visit each character in a string.
True
A loop's else block runs when a break statement ends that loop.
False
A counter can keep track of how many times a loop has run.
True
Writing a function definition automatically runs that function's body.
False
A function must accept at least one argument.
False
A function can return several results together in a tuple.
True
The join() string method can combine several strings into one string.
True
A list can contain another list as one of its items.
True
Dictionary keys must all be numbers.
False
Sorting a list of numbers changes how many items the list contains.
False
Which loop is usually best for asking for a password until it is correct?
A while loop
What is an infinite loop?
A loop that keeps repeating without ending
A loop visits rows, and a loop inside it visits each item in a row. What is this called?
A nested loop
Which statement about the stop value in range() is correct?
The stop value is excluded from the sequence
A search loop should stop as soon as a matching name is found. Which statement helps?
break
What is a function stub?
A placeholder function whose full logic will be added later
What is a parameter in a function definition?
A name that receives an input when the function is called
How does a keyword argument identify where its value should go?
By using the parameter name
What does dynamic typing allow in Python?
A variable name can refer to values of different types over time
What does it mean that functions are objects in Python?
They can be stored in variables or passed to other functions
What does a variable's scope describe?
Where in a program its name can be used
Which operation can select just the first few characters of a string?
Slicing
What does the string method lower() return?
A lowercase version of the string
A price should display two digits after the decimal point. Which feature helps?
String formatting
What does iterating over a list mean?
Visiting the items one at a time
What does a list slice let you select?
A portion of the list
Which dictionary method provides key-value pairs for a loop?
items()
Why can removing items from a list while looping over it cause problems?
Item positions change, so some items may be skipped
What is a nested dictionary?
A dictionary containing another dictionary as a value
Which Python feature provides access to command-line arguments?
sys.argv