Advertisement
Guest User

Untitled

a guest
Dec 14th, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. def basefunc(x, y, z, index = 0):
  2. return len([a for a in Counter(i[index] for i in x).values() if a >= y]) >=1
  3.  
  4. def onePair(x):
  5. return basefunc(x,2,1)
  6.  
  7. def threeOfAKind(x):
  8. return basefunc(x,3,1)
  9.  
  10. def twoPair(x):
  11. return basefunc(x,2,2)
  12.  
  13. def straight(x):
  14. return len([a for a in Counter(i[0] for i in x).values() if a != 1]) == 0
  15.  
  16. def Flush(x):
  17. return len(Counter(i[2] for i in x).values()) == 1
  18.  
  19. def fullHouse(x):
  20. return basefunc(x,2,2) and basefunc(x,3,1)
  21.  
  22. def straightFlush(x):
  23. return straight(x) and Flush(x)
  24.  
  25. def fourOfAKind(x):
  26. return basefunc(x,4,1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement