Python Practice Shuffle

Source: Internet
Author: User
Tags for in range shuffle

Poker:

#coding =utf-8import randompoker_num = [Str (i) for I in Range (2,11)] #数字牌poker_str = [' A ', ' J ', ' Q ', ' K ']  #字母牌poker_king = [' King ', ' Xiao Wang '] #大小王poker_color = [' Red ', ' black ', ' square ', ' flower '] #花色pokers = ['%s%s '% (i,j) for I in Poker_color for J in Poker_num+poker_ STR] + poker_king #生成54张牌print (len (pokers)) random.shuffle (pokers) #随机洗牌 #print (pokers) poker_a = Pokers[0:51:3] # Bucket Landlord Gameplay poker_b = Pokers[1:51:3]poker_c = Pokers[2:51:3]last_3 = Pokers[-3:]print (' A: ', poker_a) print (' B: ', poker_b) print (' C: ', poker_c) print (' Last three sheets: ', last_3)

  

Great Lotto:

# Coding=utf-8 Import   for in range (1,36 -in range (1,13= Random.sample ( daletou_qian,k=5= random.sample (daletou_hou,k=2)print(daletou_qian_random+ Daletou_hou_random)

Python Practice Shuffle

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.