Thanks Steven and Peter, I de-dented and changed the variable name and it
works now.
Cheers,
Tahir
On Sat, Dec 26, 2015 at 1:42 PM, Peter Otten <__pete...@web.de> wrote:
> Tahir Hafiz wrote:
>
> > Finally getting round to doing some more python.
> > Stuck on a little online exercise:
> > "Define
Tahir Hafiz wrote:
> Finally getting round to doing some more python.
> Stuck on a little online exercise:
> "Define a function prod(L) which returns the product of the elements in a
> list L."
>
> Let's say L = [1, 2, 3, 4]
>
> I have done this so far but it's not quite working:
>
>
>
> def
On Sat, Dec 26, 2015 at 12:59:45PM +, Tahir Hafiz wrote:
> Finally getting round to doing some more python.
> Stuck on a little online exercise:
> "Define a function prod(L) which returns the product of the elements in a
> list L."
>
> Let's say L = [1, 2, 3, 4]
>
> I have done this so far bu
Finally getting round to doing some more python.
Stuck on a little online exercise:
"Define a function prod(L) which returns the product of the elements in a
list L."
Let's say L = [1, 2, 3, 4]
I have done this so far but it's not quite working:
def prod(L):
sum = 1
for i in L: