Vidyalelo
Python · Q42

Python Lists MCQs: Exam Practice for List Concepts

Programming · Python · question 42

Q42

What will be the output of the following Python code? def increment_items(L, increment): i = 0 while i < len(L): L[i] = L[i] + increment i = i + 1 values = [1, 2, 3] print(increment_items(values, 2)) print(values)

A.
None
[3, 4, 5]
Answer
B.
None
[1, 2, 3]
C.
[3, 4, 5]
[1, 2, 3]
D.
[3, 4, 5]
None

Answer: Option A

Solution

Answer: Option A
No explanation is given for this question Let's Discuss on Board