small medium large xlarge

# PracProg2setdict

1.

```def find_dups(L):

""" (list) -> set
Return the number of duplicates numbers from a list.
Use the fact that sets does not accept duplicates.
Length of a set remains the same when trying the add
>>>find_dups([1,1,2,3,4,2])
{1,2}
>>>find_dups([1,2,3,4])
set{}
"""

elem_set = set()
dups_set = set()
for entry in L:
len_initial = len(elem_set)
len_after = len(elem_set)
if len_initial == len_after:

return(dups_set)
```

2.

```def mating_pairs(first, second):

""" (set, set) -> set of tuples

Return a set of tuples.
>>>mating_pairs({'Botta_m', 'Wagner_m', 'James_m', 'Somalian_m', 'Lowe_m'}, {'Botta_f', 'Wagner_f', 'James_f', 'Somalian_f', 'Lowe_f'})
{('Botta_m', 'Botta_f'), ('Wagner_m', 'Wagner_f'), ('James_m',  'James_f'), ('Lowe_m', 'Lowe_f'), ('Somalian_m', 'Somalian_f')}
"""

pair_list = set()
some_list = set()
males = first
females = second
list_len=len(males)

for i in range(list_len):
male = males.pop()[0:-2]
female = females.pop()[0:-2]
if male == female:
else:
push_in = (male,' ' )
push_in = (female,' ' )
for entry in some_list:
if entry[0]==' ':
some_list.remove(entry)
if entry[1]==' ':
some_list.remove(entry)
for pair in some_list:
if pair[0]==pair[1]:
pair_list.add((pair[0] + '_m', pair[1] + '_f'))
return pair_list
```
Page History
• V34: Jennifer Campbell [almost 3 years ago]
• V25: Jennifer Campbell [almost 3 years ago]
• V24: Jennifer Campbell [almost 3 years ago]
• V33: System [almost 3 years ago]
• V32: System [almost 3 years ago]
• V31: System [almost 3 years ago]
• V30: System [almost 3 years ago]
• V29: System [almost 3 years ago]
• V28: System [almost 3 years ago]
• V27: System [almost 3 years ago]