Python-Quizzes | Output Type | Question 10

What will be displayed by the following code?

filter_none

edit
close

play_arrow

link
brightness_4
code

def f(value, values):
    v = 1
    values[0] = 44
= 3
= [123]
f(t, v)
print(t, v[0])

chevron_right


(A) 1 1
(B) 1 44
(C) 3 1
(D) 3 44


Answer: (D)

Explanation: The value of t=3 is passed in funcion f(value,values) , v [list] is passed as values in the same function. The v is stored in values and values[0]=44 , changes the value at index[‘0’] in the list hence v=[44,2,3].


Quiz of this Question

My Personal Notes arrow_drop_up

Improved By : rohankumar3