Created
November 22, 2010 10:19
-
-
Save bussiere/709778 to your computer and use it in GitHub Desktop.
random de cadeau en python
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 | |
geekzone = ["AcidBen","Beasty","Mech","Azariel","BarracuddA","KaD","LordK","gabs431","Marmottas","Glasofruix","fabiouchka","Lukkant","Anaethelion","fuful","Drakulls","guts","Bussiere","ghigis"] | |
haruhi = [{"ElKaizer":"18"},{"baka-saru":"18"},{"Nautawi":"18"},{"Sedeto":"18"},{"Aryth":"Poste"},{"Grimm":"18"},{"Le Commandant":"18"},{"Fskng":"18"},{"toutoune134":"Poste"},{"nefka":"18"},{"ziassan":"18"},{"elfe":"18"},{"Bussiere":"18"}] | |
def sortliste(liste): | |
i = 0 | |
chaine = "" | |
while liste : | |
rand = (random.randint(0,len(liste)-1)) | |
nom1 = liste[rand] | |
if i == 0 : | |
nomfinal = nom1 | |
i = 1 | |
del liste[rand] | |
if (len(liste) > 0): | |
rand = (random.randint(0,len(liste)-1)) | |
nom2 = liste[rand] | |
del liste[rand] | |
chaine += str(nom1)+"->"+str(nom2)+"->" | |
else : | |
nom2 = nomfinal | |
chaine += str(nom1)+"->"+str(nom2) | |
print chaine | |
sortliste(geekzone) | |
sortliste(haruhi) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment