Is four cards

is_four_cards

1 Python[ | ]

cases = [
    [1,2,2,2,3],
    [2,2,2,2,3],
    [3,4,5,7,7,7,7],
    [4,4,4,4,7,7,7]
]

def is_four_cards(ranks):
    import collections
    counter = collections.Counter(ranks)
    for k, v in counter.items():
        if v > 3: return k
    return False 

for case in cases:
    print( case )
    print( is_four_cards( case ) )

2 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}