Lеt's create function to play cards. Our rules:

We have the preloaded `deck`:

```
deck = ['joker','2♣','3♣','4♣','5♣','6♣','7♣','8♣','9♣','10♣','J♣','Q♣','K♣','A♣',
                '2♦','3♦','4♦','5♦','6♦','7♦','8♦','9♦','10♦','J♦','Q♦','K♦','A♦',
                '2♥','3♥','4♥','5♥','6♥','7♥','8♥','9♥','10♥','J♥','Q♥','K♥','A♥',
                '2♠','3♠','4♠','5♠','6♠','7♠','8♠','9♠','10♠','J♠','Q♠','K♠','A♠']
```

We have 3 arguments:

`card1` and `card2` - any card of our deck.

`trump` - the main suit of four ('♣', '♦', '♥', '♠').

If both cards have the same suit, the big one wins.

If the cards have different suits (and no one has trump) return 'Let's play again.'

If one card has `trump` unlike another, wins the first one.

If both cards have `trump`, the big one wins.

If `card1` wins, return 'The first card won.' and vice versa.

If the cards are equal, return 'Someone cheats.'

A few games:

```
('3♣', 'Q♣', '♦') -> 'The second card won.'

('5♥', 'A♣', '♦') -> 'Let us play again.'

('8♠', '8♠', '♣') -> 'Someone cheats.'

('2♦', 'A♠', '♦') -> 'The first card won.'

('joker', 'joker', '♦') -> 'Someone cheats.'

```
P.S. As a card you can also get the string 'joker' - it means this card always wins.

Difficulty: introductory

Starter code:

def card_game(card_1, card_2, trump):
	

Solutions:
vals='2345678910JQKA'
def card_game(card_1, card_2, trump):
    print((card_1, card_2, trump))
    if card_1==card_2: return 'Someone cheats.'
    elif 'joker' in [card_1,card_2]:
        return ['The first card won.', 'The second card won.'][card_1!='joker']
    elif card_1[-1]==card_2[-1]:
        return ['The first card won.', 'The second card won.'][vals.index(card_2[0])>vals.index(card_1[0])]
    elif card_1[-1]!=trump!=card_2[-1]:
        return 'Let us play again.'
    else:
        return ['The first card won.', 'The second card won.'][card_1[-1]!=trump]

ORDERS = ['2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K', 'A']
RESULTS = ['Let us play again.', 'The first card won.', 'The second card won.', 'Someone cheats.']

def f(c1, c2, trump):
    if c1 == c2:
        return -1

    if c1 == 'joker':
        return 1
    elif c2 == 'joker':
        return 2

    cards = c1, c2
    n1, n2 = (ORDERS.index(c[:-1]) for c in cards)
    s1, s2 = (c[-1] for c in cards)
    won = 0
    if s1 == s2:
        if n1 > n2:
            return 1
        elif n1 < n2:
            return 2
    elif s1 == trump:
        return 1
    elif s2 == trump:
        return 2
    return 0


def card_game(card_1, card_2, trump):
    return RESULTS[f(card_1, card_2, trump)]

def card_game(card_1, card_2, trump):
    card_1_wins, card_2_wins, cards = "The first card won.", "The second card won.", {'J': 11, 'Q': 12, 'K': 13, 'A': 14}
    if card_1 == card_2:
        return "Someone cheats."
    if card_1 == "joker":
        return card_1_wins
    if card_2 == "joker":
        return card_2_wins
    if card_1[-1] == card_2[-1]:
        card_1_value = cards[card_1[0:-1]] if card_1[0:-1].isalpha() else int(card_1[0:-1])
        card_2_value = cards[card_2[0:-1]] if card_2[0:-1].isalpha() else int(card_2[0:-1])
        return card_1_wins if card_1_value > card_2_value else card_2_wins
    return card_1_wins if card_1[-1] == trump else card_2_wins if card_2[-1] == trump else "Let us play again."

def card_game(c1, c2, trump):
    if c1 == c2 :
        return "Someone cheats."
    if 'joker' in [c1,c2]:
        return get_win(c2 =='joker')
    if all((c1[-1] != c2[-1], any((c1[-1]==trump, c2[-1]==trump)) )):
        return get_win(c2[-1] == trump)
    if c1[-1] == c2[-1]:
        c1 , c2 = [ '234567891JQKA'.index(e) for e in [c1[0],c2[0]] ]
        return get_win( c2 > c1 )
    return "Let us play again."
    
get_win = lambda bool : "The {} card won.".format( ['first','second'][bool] ) 

value = {'J':11, 'Q':12, 'K':13, 'A':14}
get_val = lambda x: value[x] if x in value else int(x)

def card_game(card_1, card_2, trump):
    if card_1 == card_2: return "Someone cheats."
    if card_1 == "joker": return "The first card won."
    if card_2 == "joker": return "The second card won."
    if card_1[-1] == card_2[-1]:
        return "The first card won." if get_val(card_1[:-1]) > get_val(card_2[:-1]) else "The second card won."
    if card_1[-1] == trump: return "The first card won."
    if card_2[-1] == trump: return "The second card won."
    return "Let us play again."

def card_game(card_1, card_2, t):
    if card_1 == card_2:
        return "Someone cheats."
    if card_1 == 'joker':
        return "The first card won."
    if card_2 == 'joker':
        return "The second card won."
    f_val = lambda v: int(v) if v.isdigit() else 10 + ' JQKA'.index(v)
    c1, t1 = f_val(card_1[:-1]), card_1[-1]
    c2, t2 = f_val(card_2[:-1]), card_2[-1]
    if t1 in [t, t2]:
        return f'The {["first", "second"][t2 == t1 and c2 > c1]} card won.'
    return "The second card won." if t2 == t else "Let us play again."

deck = ['joker','2♣','3♣','4♣','5♣','6♣','7♣','8♣','9♣','10♣','J♣','Q♣','K♣','A♣',
                '2♦','3♦','4♦','5♦','6♦','7♦','8♦','9♦','10♦','J♦','Q♦','K♦','A♦',
                '2♥','3♥','4♥','5♥','6♥','7♥','8♥','9♥','10♥','J♥','Q♥','K♥','A♥',
                '2♠','3♠','4♠','5♠','6♠','7♠','8♠','9♠','10♠','J♠','Q♠','K♠','A♠']

def card_game(card_1, card_2, trump):
    if card_1 == card_2:
        return "Someone cheats."
    ordinal, trumps = ["first", "second"], f"{card_1}{card_2}".count(trump)
    if "joker" in (card_1, card_2):
        winner = ordinal[card_2 == "joker"]
    elif trumps == 1:
        winner = ordinal[trump in card_2]
    elif card_1[-1] == card_2[-1]:
        winner = ordinal[deck.index(card_2) > deck.index(card_1)]
    elif trumps == 0:
        return "Let us play again."
    return f"The {winner} card won."

d = '2 3 4 5 6 7 8 9 10 J Q K A'.split()
ret = lambda fn,c1,c2,t:f"The {['first','second'][eval(fn)]} card won." if fn else "Let us play again."
def card_game(c1,c2,t):
    return ret('d.index(c1[:-1])<d.index(c2[:-1])' if c1[-1] == c2[-1] else\
               'c2=="joker"' if 'joker' in [c1,c2] else\
               'c2[-1]==t' if t in [c1[-1],c2[-1]] else \
               '',c1,c2,t) if c1 != c2 else "Someone cheats."  #no effeciency due to eval :(

def card_game(card_1, card_2, trump):
    deck_dict = {'J':11, 'Q':12, 'K':13, 'A':14}
    suit_1 = card_1[-1]
    suit_2 = card_2[-1]
    if card_1 == card_2: return 'Someone cheats.'
    elif card_1 == 'joker': return 'The first card won.'
    elif card_2 == 'joker': return 'The second card won.'
    rank_1 = card_1[0:-1]
    rank_2 = card_2[0:-1]
    rank_1 = int(deck_dict.get(rank_1,rank_1))
    rank_2 = int(deck_dict.get(rank_2,rank_2))

    if   suit_1 == suit_2 and rank_1 > rank_2: return 'The first card won.'
    elif suit_1 == suit_2 and rank_1 < rank_2: return 'The second card won.'

    elif suit_1 != suit_2 and suit_1 != trump and suit_2 != trump: return 'Let us play again.'

    elif suit_1 == trump: return 'The first card won.'
    elif suit_2 == trump: return 'The second card won.'

    return 'Oops'