If you used dict() to record the players and their corresponding points, then you can convert them to a tuple/list with the help of for loop, and screen out the points > than 21 by if statement.
Then max function in list can be applied to meet the condition. But it would return one of the players who obtain the highest score(if there are two or more with same score).
Therefore, second for loop is made to include all players who gets the largest points as winner.
My stupid way to deal with this issue
If you used dict() to record the players and their corresponding points, then you can convert them to a tuple/list with the help of for loop, and screen out the points > than 21 by if statement.
Then max function in list can be applied to meet the condition. But it would return one of the players who obtain the highest score(if there are two or more with same score).
Therefore, second for loop is made to include all players who gets the largest points as winner.
Here’s an example. Hope it is helpful