Choose the correct answer
Anonymous Quiz
71%
factorial
0%
свертка
18%
degradation
0%
secondary education
6%
replacement
0%
composition
6%
Check my result of "{0}"
What will this code do?
def f(arr):
return 0 if not arr else arr[0] + f(arr[1:])
print(f([]))
Choose the correct answer
Anonymous Quiz
50%
0
14%
None
14%
IndexError
14%
ValueError
7%
TypeError
0%
Check my result of "{0}"
What will this code do?
def f(arr):
return arr[0] if len(arr) == 1 else arr[0] + f(arr[1:])
print(f([]))
Choose the correct answer
Anonymous Quiz
8%
0
25%
None
50%
IndexError
17%
ValueError
0%
TypeError
0%
See solution
What will this code do?
def f(arr):
first, *rest = arr
return first if not rest else first + f(rest)
print(f([]))
Choose the correct answer
Anonymous Quiz
11%
0
22%
None
22%
IndexError
33%
ValueError
11%
TypeError
0%
See solution
What will this code do?
def f(n):
def g(x):
return x**n
return g
g = f(2)
print(g(7))
Choose the correct answer
Anonymous Quiz
0%
0
0%
1
7%
2
13%
4
0%
7
60%
49
13%
128
7%
None
0%
TypeError
0%
See solution
What will this code do?
def f():
_x = None
def g(x=None):
nonlocal _x
if x is None:
return _x
_x = x
return g
g = f()
print(g(), g(10), g(), g(5), g())
Choose the correct answer
Anonymous Quiz
10%
None None 10 10 5
20%
None 10 10 5 5
30%
None None 10 None 5
10%
None None 10 10 5
10%
None None 10 5 5
20%
None 10 None 5 None
0%
See solution
What will this code do?
def f(x):
y = x ** 2
return y
print(*f.__code__.co_varnames)
What will this code do?
def f(x, y):
f.y = y
f.z = f.y
return x
print(f(1, 2), [x for x in dir(f) if not x.startswith('__')])
Choose the correct answer
Anonymous Quiz
11%
1 2
0%
1 []
0%
1 [2]
33%
1 ['y', 'z']
11%
1 ['x', 'y', 'z']
22%
1 ['x', 'y']
11%
1 ['x', 'z']
0%
NameError
0%
AttributeError
11%
See solution
What will this code do?
def f(arr):
return 0 if not arr else arr[0] + f(arr[1:])
print(f(('a', 'b', 'c', 'd')))
Choose the correct answer
Anonymous Quiz
44%
abcd
0%
None
44%
TypeError
11%
IndexError
0%
ValueError
0%
See solution
What will this code do?
def f(arr):
return arr[0] if len(arr) == 1 else arr[0] + f(arr[1:])
print(f(('a', 'b', 'c', 'd')))
Please select a valid option
Anonymous Quiz
73%
abcd
0%
None
27%
TypeError
0%
IndexError
0%
ValueError
0%
See solution
What will this code do?
def f(arr):
first, *rest = arr
return first if not rest else first + f(rest)
print(f(('H', 'e', 'l', 'l', 'o')))
Choose the correct answer
Anonymous Quiz
79%
Hello
7%
None
0%
TypeError
14%
IndexError
0%
ValueError
0%
See solution