Skip to content

Instantly share code, notes, and snippets.

@sota1235
Created March 19, 2015 09:45
Show Gist options
  • Save sota1235/2ec1e37021ff8c10b17d to your computer and use it in GitHub Desktop.
Save sota1235/2ec1e37021ff8c10b17d to your computer and use it in GitHub Desktop.
#!/usr/bin/python
# -*- coding:utf-8 -*-
# http://qiita.com/hisui@github/items/b47c411437d60440a605
p = int(input("人数を入力してください"))
c = input("カードを空白区切りで入力してください").split()
ans = [[] for i in range(p)]
c = c[:-(len(c)%p)]
for i in range(len(c)):
ans[i % p].append(c[i])
print(ans)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment