This easy Python question deals with pre-preprocessing. In it, you’re provided with a sorted list of positive integers with some entries being None.
Here’s the solution code for this problem:
def fill_none(input_list):
prev_value = 0
result = []
for value in values:
if value is None:
result.append(prev_value)
else:
result.append(value)
prev_value = value
return result