What will this code do?
def f(a: int = 5, b: int = 3, c: int = 4) -> int:
return a + b + c
print(f(2.5, b=2))
Choose the correct answer
Anonymous Quiz
5%
int
5%
4.5
40%
8.5
15%
11
5%
12
25%
TypeError
0%
SyntaxError
5%
See solution
What will this code do?
import sys
f = lambda x: list(map(sys.stdout.write, x))
t = f(['1', '2', '3'])
Choose the correct answer
Anonymous Quiz
16%
[123]
0%
[321]
26%
123
32%
1 2 3
16%
321
0%
3 2 1
11%
See solution
What will this code do?
def f(a: int = '1', b: int = '2', c: int = '3') -> int:
return a + b + c
print(f())
Choose the correct answer
Anonymous Quiz
5%
1
5%
2
0%
3
43%
4
24%
TypeError
14%
SyntaxError
10%
See solution
What will this code do?
def f(a: int = float) -> bool:
return str
print(f())
Choose the correct answer
Anonymous Quiz
10%
<class 'int'>
10%
<class 'float'>
5%
<class 'bool'>
38%
<class 'str'>
19%
TypeError
19%
SyntaxError
0%
See solution
What will this code do?
f = lambda x: print(*x, sep=' ' , end=' ')
t = f(['a', 'b', 'c'])
Choose the correct answer
Anonymous Quiz
5%
c b a
5%
cba
55%
a b c
10%
abc
5%
a\nb\nc\n
10%
['a', 'b', 'c']
5%
TypeError
5%
SyntaxError
0%
See solution
What will this code do?
def f(a: int = 7) -> int:
return 2 + int(a)
print(f(3.5))
Choose the correct answer
Anonymous Quiz
26%
3.5
39%
5
13%
5.5
13%
9
9%
TypeError
0%
SyntaxError
0%
See solution
Choose the correct answer
Anonymous Quiz
8%
[1, 4, 9]
8%
[3, 5, 7]
20%
[2, 6, 12]
44%
[1, 8, 81]
12%
([1, 8, 9], [4, 9, 16])
8%
SyntaxError
0%
See solution
What will this code do?
def f(x: 1 = 1):
f.__annotations__["x"] += x
return f.__annotations__["x"]
print(f(), f(), f(10))