Q. What is the output of following code fragments?
(i)
def increment(n):
n. append([4])
return n
L = [1, 2, 3]
M = increment(L)
print(L, M)
(ii)
def increment(n):
n. append([49])
return n[0], n[1], n[2], n[3]
L = [23, 35, 47]
mi, m2, m3, m4 = increment (L)
print(L)
print(mi, m2, m3, m4)
print(L[3] == m4)
Answer :-
(i)
Output:-
[1, 2, 3, [4]] [1, 2, 3, [4]]
(ii)
Output: -
[23, 35, 47, [49]]
23 35 47 [49]
True
>>>
Output: -
[23, 35, 47, [49]]
23 35 47 [49]
True
>>>
please check first output l should be equal to[1,2,3]
ReplyDeleteOutput are correct . Please copy the script and paste in your idle python then run it 😊
DeleteThat is, if the function was not called.
Delete😅
ReplyDelete??
DeleteWhy at last ut says true??
ReplyDelete== is there in last line..
DeleteYes.
DeletePlss provide a video solution for this question
ReplyDeleteOk, we will try.
DeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )