PythiloMedium · 25 min · Task 49 of 100 · progress kept in this browser

Product except self

Return the product of every other number for each index, without division, in linear time. Empty input returns []; a single item returns [1].

items = [2, 3, 4]
prefix = 1
for value in items:
    print(prefix)
    prefix *= value
Your task

Return the product of every other number for each index, without division, in linear time. Empty input returns []; a single item returns [1].