Last active
January 22, 2016 17:23
-
-
Save arthuralvim/1e5932b103851845cf0a to your computer and use it in GitHub Desktop.
Sorteio dos integrantes da Copa Crocovix de Futebol de Vídeo Game.
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
# -*- 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