What is the value of 'x' after this code executes?
x = 5 if x == 5: x += 1 else: x -= 1
5
6
4
7
What will the following Python code snippet print?
mult = lambda x, y: x * y print(mult(5, 3))
15
An error message.
lambda x, y: x * y
mult(5, 3)
How many times will the word 'Hello' be printed?
for i in range(3): print('Hello')
0
2
1
3
What will the following code print: print(10 > 5 and 'apple' == 'orange')?
print(10 > 5 and 'apple' == 'orange')
10appleorange
False
Error
True
What is the primary characteristic of a set in Python?
Unordered and immutable
Ordered and immutable
Unordered and mutable
Ordered and mutable
What will the following code snippet print?
x = 5 y = 2 * x print(y)
2 * x
x * 2
10
How many expressions can a lambda function have?
Only one
As many as needed
None, it only takes arguments
Two
x = 5 if x > 10: print('x is greater than 10') elif x > 3: print('x is greater than 3') else: print('x is less than or equal to 3')
x is less than or equal to 3
x is greater than 10
x is greater than 3
What will the following code print?
my_set = {1, 2, 3} my_set.add(3) print(my_set)
{1, 2, 3}
{1, 2, 3, 3}
{3, 1, 2}
What is a lambda function in Python?
A function that recursively calls itself.
A function defined using the 'def' keyword.
A small, anonymous function defined using the 'lambda' keyword.
A function that takes another function as an argument.