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

Method _internal_state

project_euler/problem_054/sol1.py:318–325  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

316 return kind
317
318 def _internal_state(self) -> tuple[list[int], set[str]]:
319 # Internal representation of hand as a list of card values and
320 # a set of card suit
321 trans: dict = {"T": "10", "J": "11", "Q": "12", "K": "13", "A": "14"}
322 new_hand = self._hand.translate(str.maketrans(trans)).split()
323 card_values = [int(card[:-1]) for card in new_hand]
324 card_suit = {card[-1] for card in new_hand}
325 return sorted(card_values, reverse=True), card_suit
326
327 def __repr__(self):
328 return f'{self.__class__}("{self._hand}")'

Callers 1

__init__Method · 0.95

Calls 1

splitMethod · 0.80

Tested by

no test coverage detected