Q.

What is the output of the following?
elements = [0, 1, 2]
def incr(x):
return x+1
print(list(map(elements, incr)))

A. [1, 2, 3].
B. [0, 1, 2].
C. error
D. none of the mentioned
Answer» C. error
4.5k
1
Do you find this helpful?
25

View all MCQs in

Python Programming

Discussion

coder developer
1 year ago

TypeError: 'function' object is not iterable
last line should be:
print(list(map(incr, elements)))
0