easycollections
What will this output?
a = {1, 2, 3}
b = {3, 4}
print(a ^ b)Read the full question →Lists, dicts, comprehensions. Get the basics rock solid.
Difficulty mix: 6 easy, 3 medium and 1 hard. The questions are drawn from the Python library at the moment you start, so sitting the test twice does not give you the same paper.
52 Python topics are in scope. These are the real topic labels on the questions.
Six real Python questions from the same pool, snippet included. The answer options and explanations are not shown here. Those come after you attempt them.
a = {1, 2, 3}
b = {3, 4}
print(a ^ b)Read the full question →x = [i**2 for i in range(3)]
print(x)Read the full question →from enum import Enum, auto
class Color(Enum):
RED = auto()
BLUE = auto()
print(Color.RED.value, Color.BLUE.value)Read the full question →a = 256
b = 256
c = 257
d = 257
print(a is b, c is d)Read the full question →print(True + True + False)Read the full question →def deco(f):
def wrapper():
return "Decorated " + f()
return wrapper
@deco
def say():
return "Hello"
print(say())Read the full question →Prefer to pick your own questions? Browse all Python questions. See the other 10 tests.