There were 3 solutions. Everybody's homework is someone's "what's
this?"
max('asdasfd faop29v8 asejrhjhw awg5w35g aw3g5aw3g
kajhsdkfhlskjdhfakljsdhf awg3 aw3'.split(), key=len)
sorted("a AAA aa a sdfsdfsdfsdf vv".split(' '),key=len)[-1]
sorted("a AAA aa a vv".split(' '),lambda a,b: len
On Jul 28, 7:55 am, NiklasRTZ wrote:
> Sincere thanks for strengthening python's superior flexibility. Same
> function also works around an exploding index problem returning
> results for longest word where otherwise a word with whitespace
> crashes the index:
Babelfish?
--
http://mail.python.
On Jul 28, 7:03 am, Hrvoje Niksic wrote:
> Piet van Oostrum writes:
>
> >> NiklasRTZ (N) wrote:
>
> >>N> Thank you. This seems to work:
> >>N> sorted("a AAA aa a sdfsdfsdfsdf vv".split(' '),lambda a,b: len(a)-
> >>N> len(b))[-1]
> >>N> 'sdfsdfsdfsdf'
>
> > simpler:
>
> > sorted("a AAA a
Piet van Oostrum writes:
>> NiklasRTZ (N) wrote:
>
>>N> Thank you. This seems to work:
>>N> sorted("a AAA aa a sdfsdfsdfsdf vv".split(' '),lambda a,b: len(a)-
>>N> len(b))[-1]
>>N> 'sdfsdfsdfsdf'
>
> simpler:
>
> sorted("a AAA aa a sdfsdfsdfsdf vv".split(' '), key=len)[-1]
There i
NiklasRTZ wrote:
> On Jul 28, 5:02 am, Bearophile wrote:
>> On Jul 28, 10:26 am, NiklasRTZ wrote:
>>
>> > Newbie hello onwards to the .py manual asks meantime how the longest
>> > word gets determined?
>> > First word, ok
>> > 'a aa aaa a
> NiklasRTZ (N) wrote:
>N> Thank you. This seems to work:
>N> sorted("a AAA aa a sdfsdfsdfsdf vv".split(' '),lambda a,b: len(a)-
>N> len(b))[-1]
>N> 'sdfsdfsdfsdf'
simpler:
sorted("a AAA aa a sdfsdfsdfsdf vv".split(' '), key=len)[-1]
--
Piet van Oostrum
URL: http://pietvanoostru
occurs twice still naturally easier if
>N> also occured just once.
>N> Sincere thanks & regards
>N> Niklas
1. Is this homework?
2. It sounds very confusing. Are you trying to find the longest word in
a series of words seperated by spaces? find and rfind will not help
you much.
On Jul 28, 5:02 am, Bearophile wrote:
> On Jul 28, 10:26 am, NiklasRTZ wrote:
>
> > Newbie hello onwards to the .py manual asks meantime how the longest
> > word gets determined?
> > First word, ok
> > 'a aa aaa aa'[:'a aa aaa aa'.find('
On Jul 28, 10:26 am, NiklasRTZ wrote:
> Newbie hello onwards to the .py manual asks meantime how the longest
> word gets determined?
> First word, ok
> 'a aa aaa aa'[:'a aa aaa aa'.find(' ',1,10)]
Your language is not easy to understand, but I think you
Newbie hello onwards to the .py manual asks meantime how the longest
word gets determined?
First word, ok
'a aa aaa aa'[:'a aa aaa aa'.find(' ',1,10)]
'a'
rfind is another subset
>>> 'a aa aaa aa'[:'a aa aaa aa'.rfind('
10 matches
Mail list logo