Choose your answer
Anonymous Quiz
7%
False False
36%
False True
14%
True False
36%
True True
7%
See solution
What will this code do?
S = 'Hello, Max!'.isalnum()
try:
10/S
except:
print('Buy, Max')
else:
print('See you tomorrow')
Choose your answer
Anonymous Quiz
6%
Hello, Max!
56%
Buy, Max
28%
See you tomorrow
6%
ZeroDivisionError
4%
See solution
What will this code do?
"".join(chr(i) if i % 2 else chr(i).upper() for i in range(ord('a'), ord('e')))Choose your answer
Anonymous Quiz
0%
abcd
3%
ABCD
38%
AbCd
13%
AbCd
34%
aBcD
6%
Error
6%
See solution
What will this code do?
False ** False + True * 2 + ([] or (True + False))
Choose your answer
Anonymous Quiz
9%
2
19%
3
30%
4
5%
5
5%
True
5%
False
5%
None
12%
TypeError
0%
SyntaxError
12%
See solution
What will this code do?
import numpy as np
a = np.array([1, 2, 3])
b = np.array([4, 5, 6])
c = a + b
c = c * a
print(c[1])
🤩1
👍1
What will this code do?
def f(n):
s = 0
for i in range(n):
s += i
s += ~i
return s
print(f(1) + f(10) + f(100))
🤩1
Choose your answer
Anonymous Quiz
5%
-9990
0%
-4995
19%
-111
14%
0
12%
111
12%
4995
10%
9990
29%
See solution
🎉2
👍2
Which of the classes from the scikit-learn library does NOT solve the problem of regression?
Anonymous Quiz
17%
DecisionTreeRegressor
20%
RandomForestRegressor
20%
LinearRegression
37%
LogisticRegression
7%
See solution
👍1
What will this code do?
class MyList(list):
def __getitem__(self, index):
if type(index) is slice:
index = slice(index.start - 1, index.stop - 1, index.step)
elif type(index) is int:
index -= 1
return list.__getitem__(self, index)
l = MyList(["one", "two", "three", "four", "five", "six"])
print(l[1], l[-1], l[0], l[2:4])
What will this code do?
a = 1 * 1
b = 1 / 1
print(a == 1, b == 1, a is 1, b is 1)
How to print python philosophy?
Anonymous Quiz
37%
import this
12%
import philosophy
20%
print(__philosophy__)
6%
print(__pypy__)
4%
print()
8%
exec('__ph__')
14%
See solution
🤯2
What will this code do?
class A:
def __init__(self, x):
self.x = x
def __getattribute__(self, name):
if name == '__add__':
self.x *= 10
return object.__getattribute__(self, name)
def __add__(self, other):
return self.x + other.x
a1 = A(2)
a2 = A(3)
print(a1 + a2, a1.__add__(a2))
👍1