Assume that d has been initialized as an empty dictionary:
d = {}
Which of the following generates an error?
d[[1,2]] = 5
d[(1,2)] = 5
d["1,2"] = 5
d[12] = 5
1
Expert's answer
2018-08-30T03:53:46-0400
Answer is d[[1,2]] = 5 Because dictionary uses values of unchangeable types as keys. Strings, ints and tuples are unchangeable, lists are not.
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments