Sail E0 Webinar
Question
What is the output of the following piece of code?def a(b):    b = b + [5] c = [1, 2, 3, 4]a(c)print(len(c))
Options:
A .  4
B .  5
C .  1
D .  An exception is thrown
Answer: Option B


Since a list is mutable, any change made in the list in the function is reflected outside the function.



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers