Last active
May 18, 2018 01:30
-
-
Save snicmakino/337456a95f8d8a2f658aa41e19e6bca7 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 | |
import itertools | |
# 空白区切りで入力した物をランダムでペア生成するツール | |
# (奇数の場合は、1つの要素が2回出てきます) | |
names = input().split(" ") | |
random.shuffle(names) | |
if (len(names) > 2 and len(names) % 2 == 1): | |
names.append(names[0]) | |
for pair in list(zip(*[iter(names)]*2)): | |
print(pair) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment