MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / solution

Function solution

project_euler/problem_054/sol1.py:366–380  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

364
365
366def 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
383if __name__ == "__main__":

Callers 1

sol1.pyFile · 0.70

Calls 2

PokerHandClass · 0.85
compare_withMethod · 0.80

Tested by

no test coverage detected