adplus-dvertising
frame-decoration

Question

What will be the output?
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].

b.

None
[1, 2, 3].

c.

[3, 4, 5].
[1, 2, 3].

d.

[3, 4, 5].
None

Posted under Python

Answer: (a).None
[3, 4, 5].

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What will be the output?