Trace before running
scores = [72, 85, None, 91, 0]
valid = [x for x in scores if x is not None]
print(len(valid), sum(valid))Need a hint?
Zero is a valid number. None is the missing-value marker in this example.
Worked solution & reasoning
It prints 4 248. Only None is excluded; 0 remains.
A filter such as “if x” would also remove zero because zero is falsy in Python. That would change the sample and bias the mean upward for these data.