[Solved] Why python showing can’t assign to literal in dictionary? [closed]

[ad_1]

The first = in the second line is wrong. This should work:

dict1['W'] = ['Spring']

Note however that this way, you are setting dict1['W'] to a list containing 'Spring', not to the string “Spring” itself.

[ad_2]

solved Why python showing can’t assign to literal in dictionary? [closed]