--
Message: 1
Date: Mon, 27 Feb 2012 20:10:42 +0100
From: Robert Sjoblom robert.sjob...@gmail.com
To: Alan Gauld alan.ga...@btinternet.com
Cc: tutor@python.org
Subject: Re: [Tutor] new to programming and wondering about an
I was wondering whether there is a faster/better/cleaner way of
element wise operations of arbitrarily nested list. I wrote something
like this for 1 level nested lists and am wondering whether there are
any good idioms in python. I did this after a ridiculous amount of
bad thinking/missteps in
Sivaram Neelakantan wrote:
I was wondering whether there is a faster/better/cleaner way of
element wise operations of arbitrarily nested list. I wrote something
like this for 1 level nested lists and am wondering whether there are
any good idioms in python. I did this after a ridiculous
On 2/28/2012 11:40 AM, Peter Otten wrote:
def product(factors, product=1):
for factor in factors:
product *= factor
return product
can be simplified
def product(factors):
import operator
return reduce(operator.mul, factors)
--
Bob Gailer
919-636-4239
Chapel Hill NC
bob gailer wrote:
On 2/28/2012 11:40 AM, Peter Otten wrote:
def product(factors, product=1):
for factor in factors:
product *= factor
return product
can be simplified
def product(factors):
import operator
return reduce(operator.mul, factors)
If I had used
Hello,
I'm new to Python. Just started a few weeks ago and I've been learning some
basic things that I would like to put together but I don't even know where
to began. I am trying to do the following:
Make a program using two sentences of about 8 words (total between the two
sentences). I
Hello,
I am trying to do the following:
Make a program using two sentences of about 8 words (total between the two
sentences). I would then like to create a dictionary {} and split the
words of each sentence using one sentence as a dictionary key and using the
other sentence for the dictionary
Justin wrote:
I'm new to Python. Just started a few weeks ago and I've been learning some
basic things that I would like to put together but I don't even know where to
began. I am trying to do the following:
Make a program using two sentences of about 8 words (total between the two
justin fargus wrote:
Hello,
I'm new to Python. Just started a few weeks ago and I've been learning some
basic things that I would like to put together but I don't even know where
to began. I am trying to do the following:
Make a program using two sentences of about 8 words (total between the
The two sentences I would like to use in the program is the following:
This is line one\nThis is line two! so I write: text_message = This is line
one\nThis is line two!
The dictionary name and key/value pairs will be:
my_sentences {'This':'This','is':'is','line':'line','one':'two'} # Does this
10 matches
Mail list logo