def extract_and_zero_grades(fields, d):
    """Extract an array of grades from a dictionary; convert non-numeric values to 0.0"""
    grades = []
    for f in fields:
        try:
            g = float(d[f])
        except ValueError:
            g = 0.0
        grades.append(g)
    return grades
