← Questions

Deal five-card poker hands and pick the winners

0
OpenAICodingLast asked Oct 2026

Players sit in a fixed order and cards are dealt round-robin from a given sequence until everyone holds five. Cards are written as a rank (2 to 9, T, J, Q, K, A) and a suit.

  1. Simulate the deal and record which player got which card.
  2. Classify every hand with the standard poker categories, from straight flush down to high card, and compare hands within a category by their ranks.
  3. Return the winner, or every player tied for the best hand.

Keep the hand ranking easy to change, since the interviewer adds rules as you go.

Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding