def valid_barcode(s):
    """Determines whether a barcode is valid or not based on length and
    the check digit. A "UPC-A" barcode consists of 12 digits, with the
    last digit being the check digit. Some examples:

    valid_barcode('036000291452') # --> True
    valid_barcode('036000291450') # --> False
    valid_barcode('075678164125') # --> True
    valid_barcode('')            # --> False

    :param s: barcode number
    :type s: str
    :return: true if the barcode is valid, false otherwise
    :rtype: bool
    """
    # implement this function!

    sum_odd = 0
    sum_even = 0

    if len(s) != 12:
        return False
    else:

        for i in range(0, 12, 2):
            sum_odd += int(s[i])

            if i >= 10:
                sum_even += 0
            else:
                sum_even += int(s[i+1])

        mult_odd = sum_odd * 3
        add_and_modulo = (mult_odd + sum_even) % 10
        final_answer = 10 - add_and_modulo

    if len(s) == 12 and int(s[11]) == final_answer:
        return True
    else:
        return False