Q. Consider the following code and predict the result of the following statements.
bieber = ['om', 'nom', 'nom']
counts = [1, 2, 3]
nums = counts
nums.append (4)
(i) counts is nums
(ii) counts is add([1, 2], [3, 4])
Answer =
(i)
>>> counts is nums
True
>>>
(ii)
>>> counts is add([1, 2], [3, 4])
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
counts is add([1, 2], [3, 4])
NameError: name 'add' is not defined
>>>
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )