Choose the correct answer
Anonymous Quiz
0%
-3
67%
-2
8%
-1
17%
0
8%
[2, 0, -2]
0%
[-1, -2, -3]
0%
[-3, -2, -1, 0, 1, 2]
0%
See solution
What will this code do?
def f(*args):
result = []
for seq in args:
for x in seq:
if not x in result:
result.append(x)
return ''.join(result)
s1, s2, s3= "message", "massage", "mask"
print(f(s1, s2, s3))
Choose the correct answer
Anonymous Quiz
50%
mesagk
0%
mssa
0%
msa
8%
mesag
8%
message
0%
massage
0%
mask
25%
messagemassagemask
8%
blank line
0%
Check my result of "{0}"
What will this code do?
def f(*args):
result = []
for x in args[0]:
for w in args[1:]:
if x in w:
break
else:
result.append(x)
return "".join(result)
s1, s2, s3= "hello", "hi", "good morning"
print(f(s1, s2, s3))
Choose the correct answer
Anonymous Quiz
10%
hellohigoodmorning
20%
hello
10%
good morning
10%
hi
50%
ell
0%
heloigd mrn
0%
blank line
0%
See solution
What will this code do?
sorted([1, 2, 3, 4, 5], key=lambda x: -x, reverse=True)
Choose the correct answer
Anonymous Quiz
33%
[1, 2, 3, 4, 5]
6%
[-1, -2, -3, -4, -5]
6%
[5, 4, 3, 2, 1]
39%
[-5, -4, -3, -2, -1]
6%
None
6%
TypeError
6%
See solution
What will this code do?
def f(arr):
if not arr:
return 0
return arr[0] + f(arr[1:])
f([1, 2, 3, 4, 5])
What is the result of calculating this function called??
def f(n):
return n * f(n-1) if n > 1 else 1
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())