<commit_before>#
# In the first Lesson of the class we are attempting to
# build a Poker program.
#

def poker(hands):
  "Return the best hand: poker([hand,...]) => hand"
  return max(hands, key=hand_rank)


def hand_rank(hand):
  "Return a value indicating the rank of a hand."
  ranks = card_ranks(hand)

  if straight(ranks) and flush(hand):            # straight flush
    return (8, max(ranks))
  elif kind(4, ranks):                           # 4 of a kind
    return (7, kind(4, ranks), kind(1, ranks))
  elif kind(3, ranks) and kind(2, ranks):        # full house
    return # your code here
  elif flush(hand):                              # flush
    return # your code here
  elif straight(ranks):                          # straight
    return # your code here
  elif kind(3, ranks):                           # 3 of a kind
    return # your code here
  elif two_pair(ranks):                          # 2 pair
    return # your code here
  elif kind(2, ranks):                           # kind
    return # your code here
  else:                                          # high card
    return # your code here


def card_ranks(hand):
  pass


def test():
  "Test cases for the functions in poker program"
  sf = "6C 7C 8C 9C TC".split()
  fk = "9D 9H 9S 9C 7D".split()
  fh = "TD TC TH 7C 7D".split()
  assert poker([sf, fk, fh]) == sf
  assert poker([fk, fh]) == fk
  assert poker([fh, fh]) == fh
  assert poker([fh]) == fh
  assert poker([sf] + 99 * [fh]) == sf
  assert hand_rank(sf) == (8, 10)
  assert hand_rank(fk) == (7, 9, 7)
  assert hand_rank(fh) == (6, 10, 7)
  return 'tests pass'

print test()<commit_msg>Sigh. I'm just going to go his route.<commit_after>#
# In the first Lesson of the class we are attempting to
# build a Poker program.
#

def poker(hands):
    "Return the best hand: poker([hand,...]) => hand"
    return max(hands, key=hand_rank)

def hand_rank(hand):
    ranks = card_ranks(hand)
    if straight(ranks) and flush(hand):            # straight flush
        return (8, max(ranks))
    elif kind(4, ranks):                           # 4 of a kind
        return (7, kind(4, ranks), kind(1, ranks))
    elif kind(3, ranks) and kind(2, ranks):        # full house
        return # your code here
    elif flush(hand):                              # flush
        return # your code here
    elif straight(ranks):                          # straight
        return # your code here
    elif kind(3, ranks):                           # 3 of a kind
        return # your code here
    elif two_pair(ranks):                          # 2 pair
        return # your code here
    elif kind(2, ranks):                           # kind
        return # your code here
    else:                                          # high card
        return # your code here

def test():
    "Test cases for the functions in poker program"
    sf = "6C 7C 8C 9C TC".split() # Straight Flush
    fk = "9D 9H 9S 9C 7D".split() # Four of a Kind
    fh = "TD TC TH 7C 7D".split() # Full House
    assert poker([sf, fk, fh]) == sf
    assert poker([fk, fh]) == fk
    assert poker([fh, fh]) == fh
    assert poker([sf]) == sf
    assert poker([sf] + 99*[fh]) == sf
    assert hand_rank(sf) == (8, 10)
    assert hand_rank(fk) == (7, 9, 7)
    assert hand_rank(fh) == (6, 10, 7)
    return 'tests pass'
{'fraction_non_alphanumeric': 0.11569749924676108, 'fraction_numerical': 0.021090689966857486, 'mean_word_length': 1.8183361629881154, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2452311', 'n_tokens_mistral': 1092, 'n_tokens_neox': 1027, 'n_words': 385}