Advertisement
Guest User

Untitled

a guest
Jan 29th, 2020
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.66 KB | None | 0 0
  1. def check_combination(cards:list):
  2.     pairs = {i:cards.count(i) for i in cards if cards.count(i) >1}
  3.     pairs=list(pairs.values())
  4.     if len(set(cards))==1:
  5.         return "Impossible"
  6.     else:
  7.         if sorted(cards) == [*range(sorted(cards)[0],sorted(cards)[0]+5)]:
  8.             return "Straight"
  9.         elif pairs==[2,3] or pairs==[3,2]:
  10.             return "Full House"
  11.         elif pairs==[2,2]:
  12.             return "Two Pairs"
  13.         elif pairs==[2]:
  14.             return "One Pair"
  15.         elif pairs==[3]:
  16.             return "Three of a Kind"
  17.         elif pairs==[4]:
  18.             return "Four of a Kind"
  19.         else:
  20.             return "Nothing"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement