osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Accumulate , Range and Zeros


Greetings,

Given this snippet

from itertools import *
import operator


x = [1, 2, 3] # [0, 1, 2, 3, ..., 10]

y = accumulate(x, operator.mul)

print(list(y))

why does x = list(range(5)) produces only zeros?

-- 
Abdur-Rahmaan Janhangeer
http://www.pythonmembers.club | https://github.com/Abdur-rahmaanJ
Mauritius