-
Notifications
You must be signed in to change notification settings - Fork 0
/
marry_couples.py
18 lines (15 loc) · 992 Bytes
/
marry_couples.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
def marry_couples(population):
for suitor in population:
if suitor.age > 15 and suitor.age < 66:
for match in population:
if suitor.first_name != match.first_name and suitor.last_name != match.last_name:
if match.age > 15 and match.age < 66:
if match.sex == suitor.preference and suitor.sex == match.preference:
if suitor.spouse == None and match.spouse == None:
suitor.spouse = match
match.spouse = suitor
match.maiden_name = match.last_name
match.last_name = suitor.last_name
print("{} {} married {} {}, who is now {} {}-{}".format(suitor.first_name, suitor.last_name, match.first_name, match.maiden_name, match.first_name, match.maiden_name, match.last_name))
print("")
return population