Can we shorter this code without using := because my python version is lower than 3.8?
arr = [3,2,1,0]
ml = .7
arrSum = 0
res = []
for a in reversed(arr):
arrSum = a + ml*arrSum
res.append(arrSum)
res[::-1]
# [4.89, 2.7, 1.0, 0.0]
with :=:
>>> arrSum = 0
>>> [arrSum := a + ml*arrSum for a in reversed(arr)][::-1]
[4.89, 2.7, 1.0, 0.0]
It's Okay If solution be with numpy or ... .