fork download
  1.  
  2. # 遊園地
  3.  
  4. cards=[i for i in range(1,14)]*4
  5.  
  6. import random
  7. random.shuffle(cards)
  8.  
  9. l=cards[0:26]
  10. r=cards[26:52]
  11.  
  12.  
  13. import collections
  14.  
  15. use1=[]
  16. use2=[]
  17.  
  18. def Sample(xxx,yyy):
  19. xxx=collections.Counter(xxx).most_common()
  20. xxx=[list(i) for i in xxx]
  21. for i in xxx:
  22. if i[1]%2==0:continue
  23. if i[1]%3==0:i[1]=i[1]-2
  24. yyy.append(i)
  25.  
  26. Sample(l,use1),Sample(r,use2)
  27.  
  28.  
  29.  
  30. print(sorted(use1))
  31. print(sorted(use2))
Success #stdin #stdout 0.05s 11760KB
stdin
Standard input is empty
stdout
[[1, 1], [2, 1], [3, 1], [4, 1], [9, 1], [10, 1], [11, 1], [12, 1]]
[[1, 1], [2, 1], [3, 1], [4, 1], [9, 1], [10, 1], [11, 1], [12, 1]]