Exercise 1

def find_dups(list):

""" (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
 an already existing element.
 >>>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 list:
    len_initial = len(elem_set)
    elem_set.add(entry)
    len_after = len(elem_set)
    if len_initial == len_after:
        dups_set.add(entry)
return(dups_set)

Exercise 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:
        some_list.add((male, female))
    else:
        push_in = (male,' ' )
        some_list.add(push_in)
        push_in = (female,' ' )
        some_list.add(push_in)
        for entry in some_list:
            if entry[0]  ' ':
                some_list.remove(entry)
                some_list.add((male, entry[1]))                    
            if entry[1]  ' ':
                some_list.remove(entry)
                some_list.add((entry[0], female))
for pair in some_list:
    if pair[0] == pair[1]:
        pair_list.add((pair[0] + '_m', pair[1] + '_f'))
return pair_list