Created
September 3, 2015 02:55
-
-
Save yusuke0519/d54987694044d51134bc to your computer and use it in GitHub Desktop.
ランダムにサンプルを抽出する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
marks = ['club', 'diamond', 'heart', 'spade'] | |
numbers = range(1, 14) | |
cards = [(m, n) for m in marks for n in numbers] | |
random.choice(cards) # => トランプのカードのいずれか |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment