Q:

check if all tuples contain a specific value

I have a list of tuples representing playing cards: hand = [('A', '♣'), ('A', '♠'), ('A', '♦'), ('A', '♥'), ('K', '♠')] and I want to check if I have a flush.
I thought of using all(h[1] == '♠' for h in hand) and it seems to work well (False in this case, but True in others, where it should. Of course I'll need to check this for all 4 suits...), but I wanted to know if this is the right/best way to do so

A:

You could:
any(all(h[1] == suit for h in hand) for suit in ('♣','♠','♦','♥'))

Which isn't very efficient but very readable in my opinion or you could do as suggested by @ Ev. Kounis in the comments, which is much more efficient solution but not very readable. Since this game only has 52 cards per deck, 4 suits, 13 sets, and 5 cards per hand, the numbers aren't so large that they require any special treatment for efficiency, so I would go with this solution.

