human
I found an interesting problem on https://www.codewars.com/kata/586423aa39c5abfcec0001e6:
A famous casino is suddenly faced with a sharp decline of their revenues. They decide to offer Texas hold'em also online. Can you help them by writing an algorithm that can rank poker hands? 

Task:

Create a poker hand that has a constructor that accepts a string containing 5 cards:

```python
hand = PokerHand("KS 2H 5C JD TD")
```

The characteristics of the string of cards are:

A space is used as card seperator
Each card consists of two characters
The first character is the value of the card, valid characters are:
`2, 3, 4, 5, 6, 7, 8, 9, T(en), J(ack), Q(ueen), K(ing), A(ce)`
The second character represents the suit, valid characters are: 
`S(pades), H(earts), D(iamonds), C(lubs)`


The poker hands must be sortable by rank, the highest rank first:

```python
hands = []
hands.append(PokerHand("KS 2H 5C JD TD"))
hands.append(PokerHand("2C 3C AC 4C 5C"))
hands.sort() (or sorted(hands))
```

Apply the Texas Hold'em rules for ranking the cards. 
There is no ranking for the suits.
An ace can either rank high or rank low in a straight or straight flush. Example of a straight with a low ace:
`"5C 4D 3C 2S AS"`



Note:  there are around 25000 random tests, so keep an eye on performances.

I tried it in Python, but could not do it. Can you solve it?

 ... Write me a the Python program you requested?
assistant
#Here is the Python program you requested.

class PokerHand(object):
    VALUES = "A23456789TJQKA"
    

    def __repr__(self):  return self.hand

    def __init__(self, hand):
        self.hand = hand
        values = ''.join(sorted(hand[::3], key=self.VALUES[1:].index))
        suits = set(hand[1::3])
        hi_straight = values in self.VALUES
        lo_straight = values[-1] + values[:-1] in self.VALUES
        is_flush = len(suits) == 1
        self.score = (2 * sum(values.count(card) for card in values)
                      + 13 * (hi_straight or lo_straight) + 15 * is_flush,
                     [self.VALUES[:-1].index(card) if lo_straight else self.VALUES[1:].index(card) for card in values[::-1]])
        
    def __lt__(self, other):
        return other.score < self.score