Last active
March 22, 2016 15:17
-
-
Save chronossc/1a1bc6c70abd1c2b5061 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 | |
cards = ["card_{}".format(i) for i in range(1, 55)] | |
def shuffle(cards): | |
random.shuffle(cards) | |
return cards | |
print cards | |
print shuffle(cards) |
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
1 >>> import random | |
2 >>> | |
2 >>> def shuffle(cards): | |
... random.shuffle(cards) | |
... return cards | |
... | |
3 >>> cards = ["card_{}".format(i) for i in range(1, 55)] | |
4 >>> print cards | |
['card_1', 'card_2', 'card_3', 'card_4', 'card_5', 'card_6', 'card_7', 'card_8', 'card_9', 'card_10', 'card_11', 'card_12', 'card_13', 'card_14', 'card_15', 'card_16', 'card_17', 'card_18', 'card_19', 'card_20', 'card_21', 'card_22', 'card_23', 'card_24', 'card_25', 'card_26', 'card_27', 'card_28', 'card_29', 'card_30', 'card_31', 'card_32', 'card_33', 'card_34', 'card_35', 'card_36', 'card_37', 'card_38', 'card_39', 'card_40', 'card_41', 'card_42', 'card_43', 'card_44', 'card_45', 'card_46', 'card_47', 'card_48', 'card_49', 'card_50', 'card_51', 'card_52', 'card_53', 'card_54'] | |
5 >>> print shuffle(cards) | |
['card_46', 'card_29', 'card_16', 'card_43', 'card_20', 'card_24', 'card_21', 'card_15', 'card_45', 'card_36', 'card_18', 'card_12', 'card_38', 'card_35', 'card_27', 'card_37', 'card_6', 'card_23', 'card_32', 'card_10', 'card_54', 'card_3', 'card_49', 'card_13', 'card_34', 'card_14', 'card_11', 'card_22', 'card_30', 'card_47', 'card_25', 'card_48', 'card_50', 'card_41', 'card_1', 'card_8', 'card_2', 'card_51', 'card_4', 'card_26', 'card_52', 'card_17', 'card_9', 'card_39', 'card_44', 'card_19', 'card_53', 'card_40', 'card_5', 'card_42', 'card_28', 'card_33', 'card_7', 'card_31'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment