Created
September 1, 2019 13:37
-
-
Save fabienhinault/fff508b2d40f421843710035d1f6bea6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 math | |
| NOMBRE_EQUIPES = 4 | |
| def complementMultiple(n, mult): | |
| remainder = n % mult | |
| if (remainder == 0): | |
| return 0 | |
| else: | |
| return mult - remainder | |
| def sliceProp(l, propName, step, mod_value): | |
| return [l[j][propName] | |
| for j in range(0, len(l)) | |
| if j % step == mod_value ] | |
| papas = ['F***', 'M***', 'H***', 'E***', 'A***'] | |
| mamas = ['A***', 'S***', 'M***', 'B**'] | |
| enfants = [ | |
| {'nom': 'A***', 'naissance': 2010}, | |
| {'nom': 'Q***', 'naissance':2012 }, | |
| {'nom': 'E***', 'naissance':2008 }, | |
| {'nom': 'M***', 'naissance':2008 }, | |
| {'nom': 'S***', 'naissance':2010 }, | |
| {'nom': 'A***', 'naissance':2013 }, | |
| {'nom': 'M***', 'naissance':2010 }, | |
| {'nom': 'J***', 'naissance':2010 }, | |
| {'nom': 'P***', 'naissance':2012 }, | |
| {'nom': 'L***', 'naissance':2011 }, | |
| ] | |
| # {'nom': '', 'naissance':20 }, | |
| # {'nom': '', 'naissance':20 }, | |
| random.shuffle(papas) | |
| random.shuffle(mamas) | |
| enfants.sort(key = lambda x : x['naissance']) | |
| joueurs = papas + mamas + [e['nom'] for e in enfants] | |
| equipes = [joueurs[i::4] for i in range(NOMBRE_EQUIPES)] | |
| print(equipes) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment