The output of the following code:
print('lions', 'tigers', 'bears')
Syntax used to create a list
What is
list_name = []
This loop runs a block of code a specific number of times
What is a for loop?
Syntax used to create an empty dictionary
myDictionary = {}
This operator returns True only if both conditions are true.
What is "and"?
This key word is used to define a function in Python
What is def
Operator used to concatenate two strings
What is "+"?
This loop continues as long as a condition is true.
What is a while loop
Method used to get dictionary values
What is the values method?
This operator returns True if at least one condition is true.
What is "or"?
The default value of name in the function definition
def greet(name = Guest"):
print(f'hello {name}')
What is "Guest"?
Index used to access the first element of a list
What is 0
What is break?
Method used to get key, value pairs from a dictionary
What is the items() method
This unary operator negates the truth of its operand
What is "not"?
This type of argument is specified by name during a function call.
What is a keyword argument?
This method adds an item to the end of a list.
What is append()?
The error that occurs when a loop condition is always true.
What is an infinite loop?
Error that occurs when accessing a key that doesn't exist?
What is "KeyError"?
The boolean value that an empty list, empty dictionary, and numeric value of 0 evaluates to according to the rules of truthiness
What is False?
Code snippet to define a function with two parameters that prints two arguments
What is:
def newfunction(param1, param2):
print(param1,param2)
Create a slice to access the 3rd through 5 elements of a list
my_list[2:6]
A for loop to calculate the sum of scores. in the following list:
scores = [5,8,15]
sum = 0
for score in scores:
sum+=score
Code snippet to create a dictionary with two keys and two values
myDictionary = {'key1':1,'key2'; :2}
If statement to determine if a number is greater than four and less that eight
What is
if num >4 and num<8
or
if 4< number < 8?