I am trying to create a Class named poker that organizes the game poker. Right now, I am just creating a program that checks which hand you have. However, while doing this I saw that it is unnecessarily long, and I was wondering if it's possible to shorten it.
def IsHighCard(self):
if Poker.isStraightFlush is False and Poker.IsFourOfaKind is False and Poker.isFullHouse is False and Poker.IsFlush is False and Poker.IsStraight is False and Poker.isThreeOfaKind is False and Poker.IsTwoPairs is False and Poker.IsTwoPairs is False and Poker.IsOnePairs is False:
return True
else:
return False
I have so many False statements, and I was wondering if there is a way to make them less redundant.
Also, when referencing a method in my class that is in another method, should I use Poker.IsOnePairs
or Poker.IsOnePairs(self,hand).
I'm not sure if I should include the parentheses.
PS: I don't see how that duplicate is relevant. The any() function only works for iterable, I'm not using iterable here.