Open In App
Related Articles

Python-Quizzes | Output Type | Question 10

Improve Article
Improve
Save Article
Save
Like Article
Like

What will be displayed by the following code?




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


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


Answer: (D)

Explanation: The value of t=3 is passed in function 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

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 08 Sep, 2021
Like Article
Save Article
Previous
Next
Similar Reads