The problem is that when evaluating player_cards[0][1][2][3][4]
python would first evaluate player_cards[0]
which is a number (let's suppose it's 4) and then try to do something like 4[1][2][3][4]
, so it tries to interpret 4[1]
which obviously fails because 4
cannot be subscripted, hence the error.
If you want the first at most 5 elements of the array you can use a slice, so
{player_cards[0:4]}
Which, since we're starting from the beginning of the array, can be abbreviated to
{player_cards[:4]}