Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. House_deal = random.sample(range(9), k=5)
  2. Player_deal = random.sample(range(9), k=5)
  3.  
  4. hc = Counter(House_deal)
  5. pc = Counter(Player_deal)
  6. common = hc.keys() & pc.keys() #get the intersection of both keys
  7. counts = 0
  8.  
  9. for cel in common:
  10. counts += min(hc[cel], pc[cel])
  11. if counts == 0:
  12. common_0 += 1
  13. elif counts == 1:
  14. common_1 += 1
  15. elif counts == 2:
  16. common_2 += 1
  17. elif counts == 3:
  18. common_3 += 1
  19. elif counts == 4:
  20. common_4 += 1
  21. elif counts == 5:
  22. common_5 += 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement