If you use the range method with a single parameter of 30, what will be the range of integers included in the returned list?
0 through 29
A Python script make use of user input contact names and their associated phone numbers. Which data structure would be ideal for storing and accessing these associated values?
dict
What happens if you use the following statement to sort a list of numbers called numbers? numbers = numbers.sort()
numbers is a value of None
Using which higher-order function do you apply a predicate to each value within a list, and if the predicate returns true, the value is added to the resulting list?
filter
What term describes the context of a program in which a name has meaning or a defined value?
scope
A Python dictionary associates which two pairs of things?
keys and values
What is the result of the Python expression [1] + [2]?
[1, 2]
What is the return value for a function that has no return statement defined?
The function will return a special value of None.
What higher-order function process applies a function to each value in a sequence and returns a new sequence of the results?
map
The Turtle graphics toolkit was originally developed as part of what programming language for children?
Logo
What operation should you use to concatenate the elements of list2 onto the end of list1?
list1 + list2
What is the value of the Python expression 3 * "B"?
BBB
What list operation both removes and returns the element at the end of the list named "movies"?
movies.pop()
What higher-order function takes a list of values and repeatedly applies a function to accumulate a single data value?
reduce
What coordinate system is used for the Turtle graphics toolkit?
cartesian system
What accurately describes the difference between a list and a tuple?
A tuple's contents cannot be changed.
What would the following Python program output?
items = "the,quick,fox".split(",")
for s in items:
print(s)
"the quick fox" with each word on its own line
What accurately describes the use of a parameter in Python?
A parameter is the name used in the function definition for an argument that is passed to the function when it is called.
What is a common use of lambda expressions in Python?
It allows for the creation of an anonymous function, which contains the names of its arguments and a single expression.
What Turtle function moves a turtle t to (0,0) in the window, pointed east?
t.home()
When creating a list of items whose structure and data will not change, which data structure is ideal?
tuples
What would be the final value of total for the following program?
total = 0
for i in range(10):
for j in range(10):
total = total + 1
100
In Python, we say that functions are values. What best describes why this is important?
It means that functions can be assigned to variables, passed as arguments to other functions, returned as values, and stored in data structures.
What is the purpose of the return statement in a function definition?
to jump back to the code that called it and send back a value
What RGB value should you use to produce a blue color?
0, 0, 255