Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Simple secret santa without ifs and fors
import random
def match_persons(persons):
givers = persons.copy()
random.shuffle(givers)
recipients = givers[1:] + [givers[0]]
return zip(givers, recipients)
def secret_santa():
for pair in match_persons(['Marek', 'Przemek', 'Michał', 'Kamila']):
print(f"Secret santa {pair[0]} buys gift for {pair[1]}")
if __name__ == "__main__":
secret_santa()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.