- list contain only elements or items like number,string or other data typr as well.
- list work on the basis of the index value
- dictionary contain keys and value, where keys plays a role of index value.
- here key is unique value like numbers, string, not the list and value supports all type of data type.
So it is possible to insert a list at the place of values in dictionary......
program-
l=[1,2,3]
print("List is",l)
d={1:l,2:l,3:l,"one":l,"two":l}
print("Dictionary is n",d)
print(d[1])
print(d[2])
print(d[3])
print(d["one"])
print(d["two"])
List is [1, 2, 3]
Dictionary is
{1: [1, 2, 3], 2: [1, 2, 3], 3: [1, 2, 3], 'one': [1, 2, 3], 'two': [1, 2, 3]}
[1, 2, 3]
[1, 2, 3]
[1, 2, 3]
[1, 2, 3]
[1, 2, 3]
l=[1,2,3]
d={l:l}
print(d)
d={l:l}
TypeError: unhashable type: 'list'