Skip to content

Instantly share code, notes, and snippets.

@arthuralvim
Last active January 22, 2016 17:23
Show Gist options
  • Save arthuralvim/1e5932b103851845cf0a to your computer and use it in GitHub Desktop.
Save arthuralvim/1e5932b103851845cf0a to your computer and use it in GitHub Desktop.
Sorteio dos integrantes da Copa Crocovix de Futebol de Vídeo Game.
# -*- coding: utf-8 -*-
from random import shuffle
from random import sample
def sortear_partidas(duplas):
while duplas:
dupla = sample(duplas, 2)
print dupla[0], 'x========x', dupla[1]
for c in dupla:
duplas.remove(c)
def sortear(duplas):
novas_duplas = []
while duplas:
dupla = sample(duplas, 2)
novas_duplas.append(dupla)
print dupla
for c in dupla:
duplas.remove(c)
return novas_duplas
if __name__ == '__main__':
duplas = ['adones', 'arthur', 'ari', 'victor', 'leandro', 'marcio', 'luiz',
'joao', 'jonnatas', 'romero', 'mauricio', 'tiago']
shuffle(duplas)
duplas = sortear(duplas)
print '======================='
sortear_partidas(duplas)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment