Accumulate , Range and Zeros

Abdur-Rahmaan Janhangeer arj.python at gmail.com
Sat Jul 13 05:54:09 EDT 2019


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



More information about the Python-list mailing list