1. Which of the following will result in an error for a given valid dictionary D?
(i) D + 3
(i) D * 3
(iii) D + {3 : "3"}
(iv) D.update( {3 : "3"}) (v) D.update { {"3" : 3}} (vi) D.update("3" : 3)
Answers
Answered by
3
Answer:
(i),(ii)and (iii) will result in an error
reason:
>>>d={1:2,3:4}
>>> d+3
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
d+3
TypeError: unsupported operand type(s) for +: 'dict' and 'int'
>>> d*3
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
d*3
TypeError: unsupported operand type(s) for *: 'dict' and 'int'
>>> d+{3:"3"}
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
d+{3:"3"}
TypeError: unsupported operand type(s) for +: 'dict' and 'dict'
#hope it helps you
please mark brainliest
Similar questions