I have a list in which I am trying to find the count of the last element's last character. I had it working, and then it stopped. I am not sure why. self.hand[-1][-1] returns 'h', which the count should return 5. However, I am not getting 5, I return 0.
poker_hand.py
class PokerHand:
def __init__(self, hand):
self.hand = hand
self.flush = False
def is_flush(self):
if self.hand.count(self.hand[-1][-1]) == 5:
self.flush = True
main.py
from poker_hand import PokerHand, test_hand_one, test_hand_two
test_hand_one = ['Jh', 'Qh', 'Kh', 'Ah', '10h']
if __name__ == '__main__':
hand_one = PokerHand(test_hand_one)
hand_one.is_flush()
print(hand_one.flush)
current output: False