Python3 Simulation Bucket landlord licensing __python

Source: Internet
Author: User
Tags shuffle

Simulated bucket landlord licensing, a total of 54 cards,

Color: Spades (' \u2660 '), plum (' \u2663 '), Box (' \u2665 '), Red Peach (' \u2666 '), type: A2-10jqk, king Size (x, x) three persons, each 17 card, three card bottom left
Enter a carriage return and print 17 cards for the first question
Enter a carriage return and print the 17 cards for the second question.

Enter a carriage return, print the third question 17 card

Import Random as R
"" "to achieve a random 17 card" "" "Def Reduce (L, W): For x in W:l.pop (L.index (x)) return L = [' A ', ' 2 ', ' 3 ', ' 4 ', ' 5 ' , ' 6 ', ' 7 ', ' 8 ', ' 9 ', ' Ten ', ' J ', ' Q ', ' K '] H = [' \u2660 ', ' \u2663 ', ' \u2665 ', ' \u2666 '] P = [' x ', ' X '] for x in H:for Y in l:s = x + y P.append (s) r.shuffle (p) i = 0 L2 = [] While I < 2:if len (p) > 17:w = R.sample (P, 17) # Select n Random and distinct elements from the sequence L2.append (w) P = Reduce (p, W) print (W) input () E Lse:break Print (P)
Import random as R "" "The
Simple implementation of the code above" ""

L = [' A ', ' 2 ', ' 3 ', ' 4 ', ' 5 ', ' 6 ', ' 7 ', ' 8 ', ' 9 ', ' Ten ', ' J ', ' Q ', ' K ']
L1 = [' x ', ' X ']

L1.extend (Map (lambda x:x+ "\u2660", L))
l1.extend (map (lambda x:x+ "\u2663", L))
l1.extend (map (lambda x:x+ \ u2665 ", L))
l1.extend (map (lambda x:x+" \u2666 ", L))

r.shuffle (L1)
print (l1[0:17])
input ()
Print (l1[17:34])
input ()
print (l1[34:51])
input ()
print (l1[51:])
Import random as R "" "One card
at a Time" ""

L = [' A ', ' 2 ', ' 3 ', ' 4 ', ' 5 ', ' 6 ', ' 7 ', ' 8 ', ' 9 ', ' Ten ', ' J ', ' Q ', ' K ']
H = [' \u2660 ', ' \u2663 ', ' \u2665 ', ' \u2666 '] w1 = [] W2 = [] W3 = [
]

P = [' x ', ' X '] for
x in h:
  
    for y in L:
s = x + y
p.append (s)

r.shuffle (P)

i = 1 while
i <=:
W1.append (P.pop ())
W2.append (P.pop ())
W3.append (P.pop ())
i + + 1

print (W1)
input ()
Print (W2)
input ()
print (W3)
input ()
print (P)
  



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.