I am working on a 'Secret Santa' type problem. The premise is that I have a group of people participating, and some of those people may be partners. One constraint I'd like to enforce is that someone should not be assigned their partner for the purposes of this gift exchange. I'm working in Python, and am wondering if there is a more elegant solution than using a dictionary to define everyone's partner. It feels a bit clunky and error-prone to define in this way.
Currently looks like:
partners = {
'Roland': 'Jocelyn',
'Johnny': 'Moira',
'Alexis': 'Ted',
'David': 'Patrick',
'Jocelyn': 'Roland',
'Moira': 'Johnny',
'Ted': 'Alexis',
'Patrick': 'David'
}
The list of participants is just a simple list of strings. Not every participant is in a partnership.