adplus-dvertising
frame-decoration

Question

What is the output of the following code?
def change(var, lst):
    var = 1
    lst[0] = 44
k = 3
a = [1, 2, 3]
change(k, a)
print(k)
print(a)

a.

3
[44, 2, 3].

b.

1
[1,2,3].

c.

3
[1,2,3].

d.

1
[44,2,3].

Posted under Lists in Python Python

Answer: (a).3
[44, 2, 3].

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of the following code?

Similar Questions

Discover Related MCQs

Q. Suppose list1 is [3, 4, 5, 20, 5, 25, 1, 3], what is list1.count(5) ?

Q. Suppose list1 is [3, 4, 5, 20, 5], what is list1.index(5) ?

Q. To remove string “hello” from list1, we use which command ?

Q. To insert 5 to the third position in list1, we use which command ?

Q. To add a new element to a list we use which command ?

Q. Suppose list1 = [0.5 * x for x in range(0, 4)], list1 is :

Q. Which of the following matrices will throw an error in Python?

Q. What is the list comprehension equivalent for:
{x : x is a whole number less than 20, x is even} (including zero)

Q. Write a list comprehension to produce the list: [1, 2, 4, 8, 16……212].

Q. What is the list comprehension equivalent for: list(map(lambda x:x**-1, [1, 2, 3]))

Q. Write a list comprehension for producing a list of numbers between 1 and 1000 that are divisible by 3.

Q. Write a list comprehension for number and its cube for l=[1, 2, 3, 4, 5, 6, 7, 8, 9].

Q. Write the list comprehension to pick out only negative integers from a given list ‘l’.

Q. Which of the following is the same as list(map(lambda x: x**-1, [1, 2, 3]))?

Q. Which of the following is the correct expansion of list_1 = [expr(i) for i in list_0 if func(i)] ?

Q. To which of the following the “in” operator can be used to check if an item is in it?

Q. Suppose listExample is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after listExample.pop()?

Q. Suppose listExample is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after listExample.pop(1) ?

Q. Suppose listExample is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after listExample.extend([34, 5]) ?

Q. Suppose list1 is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after list1.reverse() ?