Skip to content
Snippets Groups Projects
Commit 64be6ab6 authored by Colombain Agathe's avatar Colombain Agathe
Browse files

Upload New File

parent 08b8c46a
No related branches found
No related tags found
No related merge requests found
import random
##Les noms des participants et leurs mails sont ici fictifs pour ne délivrer aucune information personnelle
participants_names = ['Alice', 'Bob', 'Charlie', 'Dana']
participants_emails = ['alice@example.com', 'bob@example.com', 'charlie@example.com', 'dana@example.com']
def tirageausort(names, emails):
results = []
while True:
shuffled_names = names.copy()
random.shuffle(shuffled_names)
if all(giver != receiver for giver, receiver in zip(names, shuffled_names)):
break
for i, name in enumerate(names):
giver = names[i]
receiver = shuffled_names[i]
receiver_email = emails[names.index(receiver)]
results.append((i, receiver))
return results
print(tirageausort(participants_names, participants_emails))
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment