In what cases in Python 3 will the answer be an integer?
Anonymous Quiz
6%
8.0 - 3
11%
4/2
71%
7//2
0%
3/2
6%
4 + 1.0
3%
4.5 % 3
3%
See solution
What will this code do?
class MyList(list):
def __iter__(self):
return iter(self*2)
m = MyList([1, 2, 3])
print(list(m))
Choose your answer
Anonymous Quiz
0%
[]
16%
[1, 2, 3]
58%
[1, 2, 3, 1, 2, 3]
13%
TypeError
0%
IndexError
13%
See solution
🤔1
What will this code do?
from random import randint
num = randint(10**8, 10**20)
s = bin(num)[2:].replace('0', '\n').replace('1', '\t')
print(s.isspace())
Choose your answer
Anonymous Quiz
9%
0
4%
1
39%
True
26%
False
4%
\n
0%
\t
9%
TypeError
9%
See solution
What will this code do?
S = " \t \n "
S.isalpha() + S.isspace() + S.isdigit() + S.isprintable()
What will this code do?
from math import log
from functools import reduce
f = lambda acc, x: x * acc
gen = (abs(log(i / 10)) for i in range(1, 1000))
print(int(reduce(f, gen, 1)))
Choose your answer
Anonymous Quiz
0%
-1
20%
0
15%
1
30%
10
20%
17844
5%
None
5%
ValueError
5%
See solution
How to reload a previously imported module "somemodule" if its code has changed (Python 3)?
Anonymous Quiz
15%
import somemodule
22%
import importlib; importlib.reload(somemodule)
26%
somemodule.reload()
4%
somemodule.reimport()import somemodule with re
15%
import somemodule with reload
0%
reimport somemodule
19%
See solution
😁1
Choose your answer
Anonymous Quiz
7%
True
7%
False
34%
0
7%
1
10%
13
24%
SyntaxError
10%
See solution
Choose your answer
Anonymous Quiz
3%
I have 10 cars
16%
True
68%
False
0%
None
3%
AttributeError
11%
See solution
What will this code do?
import numpy as np
A = np.random.randint(1, 100, size=(5, 5))
B = A.copy()
B[:, [0, -1]] = B[:, [-1, 0]]
d = lambda x: round(np.linalg.det(x))
print(d(A) + d(B))