Accumulate , Range and Zeros
On 7/13/19 5:54 AM, Abdur-Rahmaan Janhangeer wrote:
> > 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?
I see two things going on here.
(1) Don't type snippets of code and results from memory, or
in bits and pieces from an interactive session. Copy and
paste exactly the code that ran and the output that it
(2) What is range(5)? Okay, what is list(range(5))? What
do you (the person) get when you multiply those five