()
| 364 | |
| 365 | |
| 366 | def solution() -> int: |
| 367 | # Solution for problem number 54 from Project Euler |
| 368 | # Input from poker_hands.txt file |
| 369 | answer = 0 |
| 370 | script_dir = os.path.abspath(os.path.dirname(__file__)) |
| 371 | poker_hands = os.path.join(script_dir, "poker_hands.txt") |
| 372 | with open(poker_hands) as file_hand: |
| 373 | for line in file_hand: |
| 374 | player_hand = line[:14].strip() |
| 375 | opponent_hand = line[15:].strip() |
| 376 | player, opponent = PokerHand(player_hand), PokerHand(opponent_hand) |
| 377 | output = player.compare_with(opponent) |
| 378 | if output == "Win": |
| 379 | answer += 1 |
| 380 | return answer |
| 381 | |
| 382 | |
| 383 | if __name__ == "__main__": |
no test coverage detected