Created
December 9, 2025 08:59
-
-
Save MarcAlx/aea2241c5ee63b7671ccc275f47e4e9a to your computer and use it in GitHub Desktop.
Secret Santa
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
| # Simple algorithm to generate secret santa gifting, with no redundancy | |
| import random; | |
| # participants | |
| ppl = ["A", "B", "C", "D", "E", "F"]; | |
| # shuffle them | |
| random.shuffle(ppl); | |
| # for each participant | |
| for i in range(len(ppl)-1, -1, -1): | |
| # print "Gifter -> Receiver", n.b when reaching 0 it will tap -1 which will loop to first one | |
| print(ppl[i]+" -> "+ppl[i-1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment