What will this code do?
class A:
x = 1
class B(A):
pass
class C(A):
pass
A.x = 2
B.x = 3
print(B.x, C.x)
What will this code do?
from typing import Final
x: Final = 'hi'
x = 'hello'
print(x)
Choose your answer
Anonymous Quiz
23%
hi
38%
hello
8%
hi hello
8%
TypeError
0%
ValueError
23%
See solution
What will this code do?
def f(p, q):
return p + q
x = list(map(f, ('a', 'b', 'c'), ('x', 'y', 'z')))
print(x[1])
What will this code do?
x = {1: "A", 3: "B"}
y = {2: "C", 3: "D", 4: "E"}
d = {**x, **y}
vals = sorted(d.values())
print(*vals)Choose your answer
Anonymous Quiz
33%
A B C D E
6%
A B C E
50%
A C D E
6%
A B C D
0%
A B D E
6%
See solution
What will this code do?
def outer():
x = "local"
def inner():
nonlocal x
x = "nonlocal"
print(x, end=" ")
inner()
print(x)
outer()
Choose your answer
Anonymous Quiz
10%
local
20%
nonlocal
10%
nonlocal local
45%
nonlocal nonlocal
5%
local local
0%
local nonlocal
10%
See solution