(guessed, correct, empty=None)
return precision
Tests:
    >>> micro_avg_precision(['A', 'A', 'B', 'C'],['A', 'C', 'C', 'C'])
    0.5
    >>> round(micro_avg_precision([0,0,0,1,1,1],[1,0,0,0,1,0], empty=0), 6)
    0.333333
    >>> round(micro_avg_precision([1,0,0,0,1,0],[0,0,0,1,1,1], empty=0), 6)
    0.5
    >>> round(micro_avg_precision([1,0,0,0,1,0],[], empty=0), 6)
    1.0
Tests:
    >>> micro_avg_precision(['A', 'A', 'B', 'C'],['A', 'C', 'C', 'C'])
    0.5
    >>> round(micro_avg_precision([0,0,0,1,1,1],[1,0,0,0,1,0], empty=0), 6)
    0.333333
    >>> round(micro_avg_precision([1,0,0,0,1,0],[0,0,0,1,1,1], empty=0), 6)
    0.5
    >>> round(micro_avg_precision([1,0,0,0,1,0],[], empty=0), 6)
    1.0
Tests : >>> micro_avg_precision ( [ A A B C ] [ A C C C ] ) 0 . 5 >>> round ( micro_avg_precision ( [ 0 0 0 1 1 1 ] [ 1 0 0 0 1 0 ] empty = 0 ) 6 ) 0 . 333333 >>> round ( micro_avg_precision ( [ 1 0 0 0 1 0 ] [ 0 0 0 1 1 1 ] empty = 0 ) 6 ) 0 . 5 >>> round ( micro_avg_precision ( [ 1 0 0 0 1 0 ] [] empty = 0 ) 6 ) 1 . 0
def micro_avg_precision(guessed, correct, empty=None):
    """
    Tests:
    >>> micro_avg_precision(['A', 'A', 'B', 'C'],['A', 'C', 'C', 'C'])
    0.5
    >>> round(micro_avg_precision([0,0,0,1,1,1],[1,0,0,0,1,0], empty=0), 6)
    0.333333
    >>> round(micro_avg_precision([1,0,0,0,1,0],[0,0,0,1,1,1], empty=0), 6)
    0.5
    >>> round(micro_avg_precision([1,0,0,0,1,0],[], empty=0), 6)
    1.0
    """
    correctCount = 0
    count = 0

    idx = 0
    if len(guessed) == 0:
        return 1.0
    elif len(correct) == 0:
        return 1.0
    while idx < len(guessed):
        if guessed[idx] != empty:
            count += 1
            if guessed[idx] == correct[idx]:
                correctCount +=1
        idx +=1
    precision = 0
    if count > 0:
        precision = correctCount / count

    return precision
def micro_avg_precision ( guessed , correct , empty = None ) : correctCount = 0 count = 0 idx = 0 if len ( guessed ) == 0 : return 1.0 elif len ( correct ) == 0 : return 1.0 while idx < len ( guessed ) : if guessed [ idx ] != empty : count += 1 if guessed [ idx ] == correct [ idx ] : correctCount += 1 idx += 1 precision = 0 if count > 0 : precision = correctCount / count return precision