What will this code do?
def unpacking(x, y, z):
print(x, y, z, end=" ")
tuple_vec = (1, 0, 1)
dict_vec = {'x': 1, 'y': 0, 'z': 1}
unpacking(*tuple_vec)
unpacking(**dict_vec)
Choose your answer
Anonymous Quiz
2%
1 0 1
5%
1 0 1 1 1 0
66%
1 0 1 1 0 1
2%
1 : 1 0 : 0 1 : 1
11%
{'x': 1, 'y': 0, 'z': 1}
9%
TypeError
5%
See solution
😱6
What will this code do?
class B:
def __init__(self):
self.arr = []
def __getattr__(self, attrname):
return getattr(self.arr, attrname)
b = B()
b.append(1)
b.append(2)
b.append(3)
b.pop()
print(b.arr)
Choose your answer
Anonymous Quiz
23%
AttributeError
6%
[1, 2, 3]
51%
[1, 2]
11%
TypeError
9%
See solution
Choose your answer
Anonymous Quiz
17%
[1, 2, 3, 4]
1%
(1, 2, 3, 4)
69%
'1,2,3,4'
13%
'1234'
0%
See solution
Choose your answer
Anonymous Quiz
25%
<class 'bool'>
3%
<class 'int'>
59%
<class 'type'>
10%
TypeError
3%
See solution
What will this code do?
import numpy as np
import pandas as pd
a = pd.np.array([1, 2, 3])
b = np.array([-3, 2, 1])
print(a @ b)
Choose your answer
Anonymous Quiz
2%
-2
9%
0
17%
4
29%
TypeError
3%
ValueError
22%
AttributeError
17%
See solution
What will this code do?
print(list(map(lambda f: f(2), [lambda x: x**i for i in range(3)])))
Choose your answer
Anonymous Quiz
26%
[1, 2, 4]
3%
[1, 1, 1]
8%
[2, 2, 2]
18%
[4, 4, 4]
5%
TypeError
10%
ValueError
10%
AttributeError
21%
See solution
What will this code do?
print(list(map(lambda f: f(2), (lambda x: x**i for i in range(3)))))
Choose your answer
Anonymous Quiz
26%
[1, 2, 4]
5%
[1, 1, 1]
2%
[2, 2, 2]
33%
[4, 4, 4]
17%
AttributeError
0%
TypeError
0%
ValueError
17%
See solution
👍1
Choose your answer
Anonymous Quiz
22%
True
50%
False
5%
AttributeError
3%
ValueError
17%
TypeError
3%
See solution