On Mon, 12 Sep 2011 01:06 pm Chris Angelico wrote:
> On Mon, Sep 12, 2011 at 11:37 AM, Ben Finney
> wrote:
>> Those are only practically the same if you ignore the practical worth of
>> a function knowing the name it was defined with. The latter does not
>> have that, hence I don't see it as prac
On Mon, Sep 12, 2011 at 11:37 AM, Ben Finney wrote:
> Those are only practically the same if you ignore the practical worth of
> a function knowing the name it was defined with. The latter does not
> have that, hence I don't see it as practically the same as the former.
>
I know, but in the conte
Chris Angelico writes:
> A lambda is basically a function defined in an expression. For instance:
>
> def add_one(x):
>return x+1
>
> is (practically) the same as:
>
> add_one = lambda x: x+1
Those are only practically the same if you ignore the practical worth of
a function knowing the name
On Mon, Sep 12, 2011 at 4:43 AM, Ethan Furman wrote:
> Chris Angelico wrote:
>>
>> And I'd do this with a lambda, but that's just me. Of course, if your
>> logic is more complicated, it makes more sense to keep it in a named
>> function, but a single conditional call can fit nicely into a lambda.
Chris Angelico wrote:
On Sat, Sep 10, 2011 at 10:24 PM, Alister Ware
wrote:
Ignoring the docttests my process would be to process each word & then
manually capitalize he 1st word, .I would als0 use a comprehension as
makes for cleaner code:-
def capitalize(word):
if word in small_words:
On 9/11/2011 7:46 AM, Tigerstyle wrote:
Thank you Terry,
I went for this solution as it was the easiest for me to understand
and comment myself keeping in mind what level I am at right now.
Thanks a ton to everyone for sharing so much information and making it
easy to read and understand your
On 11 Sep, 04:12, t...@thsu.org wrote:
> On Sep 10, 7:47 am, Peter Otten <__pete...@web.de> wrote:
>
>
>
>
>
>
>
>
>
> > Tigerstyle wrote:
> > > I'm strugglin with some homework stuff and am hoping you can help me
> > > out here.
>
> > > This is the code:
>
> > > small_words = ('into', 'the', 'a',
On 11 Sep, 08:18, Dennis Lee Bieber wrote:
> On Sat, 10 Sep 2011 16:25:42 -0700, Dennis Lee Bieber
> declaimed the following in
> gmane.comp.python.general:
>
>
>
> > in the language documentation... It will give you a simple way to know
> > if you are looking at the first word. Basically, you wa
On 10 Sep, 17:56, Chris Angelico wrote:
> On Sat, Sep 10, 2011 at 10:24 PM, Alister Ware
>
> wrote:
> > Ignoring the docttests my process would be to process each word & then
> > manually capitalize he 1st word, .I would als0 use a comprehension as
> > makes for cleaner code:-
>
> > def capitaliz
On 10 Sep, 13:43, Mel wrote:
> Tigerstyle wrote:
> > Hi guys.
>
> > I'm strugglin with some homework stuff and am hoping you can help me
> > out here.
>
> > This is the code:
>
> > small_words = ('into', 'the', 'a', 'of', 'at', 'in', 'for', 'on')
>
> > def book_title(title):
> > """ Takes a st
On 10 Sep, 13:50, Thomas Jollans wrote:
> On 10/09/11 13:20, Tigerstyle wrote:
>
> > Hi guys.
>
> > I'm strugglin with some homework stuff and am hoping you can help me
> > out here.
>
> > All tests are failing even though I am getting the correct output on
> > the first two tests. And the last te
On 10 Sep, 19:59, Terry Reedy wrote:
> On 9/10/2011 7:20 AM, Tigerstyle wrote:
>
> > Hi guys.
>
> > I'm strugglin with some homework stuff and am hoping you can help me
> > out here.
>
> We appreciate you saying so instead of hiding that this is homework.
>
>
>
>
>
>
>
>
>
> > small_words = ('into
On Sep 10, 7:47 am, Peter Otten <__pete...@web.de> wrote:
> Tigerstyle wrote:
> > I'm strugglin with some homework stuff and am hoping you can help me
> > out here.
>
> > This is the code:
>
> > small_words = ('into', 'the', 'a', 'of', 'at', 'in', 'for', 'on')
> > new_title = []
> > title_s
Terry Reedy wrote:
> On 9/10/2011 7:47 AM, Peter Otten wrote:
>
>> You can work around that with a
>> flag along these lines
>>
>> first = True
>> for word in title_split:
>> if first:
>> # special treatment for the first word
>> first = False
>> else:
>> # pu
On 9/10/2011 7:47 AM, Peter Otten wrote:
You can work around that with a
flag along these lines
first = True
for word in title_split:
if first:
# special treatment for the first word
first = False
else:
# put checks for all words but the first here
new_
On 9/10/2011 7:20 AM, Tigerstyle wrote:
Hi guys.
I'm strugglin with some homework stuff and am hoping you can help me
out here.
We appreciate you saying so instead of hiding that this is homework.
small_words = ('into', 'the', 'a', 'of', 'at', 'in', 'for', 'on')
def book_title(title):
On Sat, Sep 10, 2011 at 10:24 PM, Alister Ware
wrote:
> Ignoring the docttests my process would be to process each word & then
> manually capitalize he 1st word, .I would als0 use a comprehension as
> makes for cleaner code:-
>
> def capitalize(word):
> if word in small_words:
> return w
On Sat, 10 Sep 2011 04:20:17 -0700, Tigerstyle wrote:
> Hi guys.
>
> I'm strugglin with some homework stuff and am hoping you can help me out
> here.
>
> This is the code:
>
> small_words = ('into', 'the', 'a', 'of', 'at', 'in', 'for', 'on')
>
> def book_title(title):
> """ Takes a string
On 10/09/11 13:20, Tigerstyle wrote:
> Hi guys.
>
> I'm strugglin with some homework stuff and am hoping you can help me
> out here.
>
> All tests are failing even though I am getting the correct output on
> the first two tests. And the last test still gives me "Of" instead of
> "of"
Cannot repro
Tigerstyle wrote:
> I'm strugglin with some homework stuff and am hoping you can help me
> out here.
>
> This is the code:
>
> small_words = ('into', 'the', 'a', 'of', 'at', 'in', 'for', 'on')
> new_title = []
> title_split = title.strip().lower().split()
> for word in title_split:
Tigerstyle wrote:
> Hi guys.
>
> I'm strugglin with some homework stuff and am hoping you can help me
> out here.
>
> This is the code:
>
> small_words = ('into', 'the', 'a', 'of', 'at', 'in', 'for', 'on')
>
> def book_title(title):
> """ Takes a string and returns a title-case string.
>
Hi guys.
I'm strugglin with some homework stuff and am hoping you can help me
out here.
This is the code:
small_words = ('into', 'the', 'a', 'of', 'at', 'in', 'for', 'on')
def book_title(title):
""" Takes a string and returns a title-case string.
All words EXCEPT for small words are mad
22 matches
Mail list logo