from functools import reduce
def f(x):
out = []
for i, _ in enumerate(x):
out.append(reduce(lambda p, q: p * q, x[:i] + x[i+1:]))
return out
print(f([1, 7, 3, 4]))
assert f([1, 7, 3, 4]) == [84, 12, 28, 21]
ZnJvbSBmdW5jdG9vbHMgaW1wb3J0IHJlZHVjZQoKZGVmIGYoeCk6CglvdXQgPSBbXQoKCWZvciBpLCBfIGluIGVudW1lcmF0ZSh4KToKCQlvdXQuYXBwZW5kKHJlZHVjZShsYW1iZGEgcCwgcTogcCAqIHEsIHhbOmldICsgeFtpKzE6XSkpCglyZXR1cm4gb3V0CgpwcmludChmKFsxLCA3LCAzLCA0XSkpCmFzc2VydCBmKFsxLCA3LCAzLCA0XSkgPT0gWzg0LCAxMiwgMjgsIDIxXQo=