Best Answer · By JanBask Python Expert
Answered on Mar 1, 2021
To get rid of this error you can use the below-mentioned code:-
>>> player=[1,2,3]
>>> player["score"]
Traceback (most recent call last):
File "", line 1, in
TypeError: list indices must be integers, not str
>>> player={'score':1, 'age': 2, "foo":3}
>>> player['score']