shhtse / 996AsiaPythonLimited

0 stars 0 forks source link

Code to determine who is winner in BLackJack #6

Open kcwu229 opened 3 years ago

kcwu229 commented 3 years ago

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 965C7C0A-987E-4481-9EA8-76F4B64A4122

peterhocheong777 commented 3 years ago

👍👍👍

garypscheng commented 3 years ago

The king of python