<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def calc_bin_cov(scaffolds, cov):
 """ calculate bin coverage """

    bases = sum([cov[i][0] for i in scaffolds if i in cov])
    length = sum([cov[i][1] for i in scaffolds if i in cov])
    if length == 0:
        return 0
    return float(float(bases)/float(length))