import random


def get_sex(sexWeight):
    """Third element of a product value is the weight of a certain sex
    buying a product.
    `random.random()` returns a float in (0, 1), thus if sexWeight=0.4,
    40% of the time it will return 'F', 60% 'M'.
    """
    if random.random() <= sexWeight: 
        return 'F'
    else:
        return 'M'