Re: [Tutor] sort problem

2010-09-08 Thread Roelof Wobben
Date: Wed, 8 Sep 2010 20:10:28 +0200 From: f...@libero.it To: tutor@python.org Subject: Re: [Tutor] sort problem On 08/09/2010 19.12, Francesco Loffredo wrote: > ... > a little example: > > separator = "Roelof" > list = ["Wobben", "Python", "L

Re: [Tutor] sort problem

2010-09-08 Thread Francesco Loffredo
On 08/09/2010 19.12, Francesco Loffredo wrote: ... a little example: separator = "Roelof" list = ["Wobben", "Python", "Learner"] print separator.join(list) ... what you will get? Guess before you try. There's more, I forgot to add: print separator This is important, this method *returns* a

Re: [Tutor] sort problem

2010-09-08 Thread Francesco Loffredo
On 08/09/2010 19.12, Roelof Wobben wrote: ... Oke, If I understand it right with join I can put two strings into 1 string. Roelof Not quite. With join you can put together in one string all the elements of a list of strings. While you do so, you can also put another string as a "wall" between e

Re: [Tutor] sort problem

2010-09-08 Thread Alan Gauld
"Roelof Wobben" wrote > Carefully read the documentation for str.join: > http://docs.python.org/library/stdtypes.html#str.join > >How does it work, what does it return, etc. Then fix the >corresponding line in your code. str.join(iterable)ΒΆ It puts all the elements of iterable into one s

Re: [Tutor] sort problem

2010-09-08 Thread bob gailer
On 9/8/2010 1:12 PM, Roelof Wobben wrote: If I understand it right You don't. What does "put two strings into 1 string" mean. Provide an example. What does the documentation say about join? What part of that do you not understand? -- Bob Gailer 919-636-4239 Chapel Hill NC __

Re: [Tutor] sort problem

2010-09-08 Thread Roelof Wobben
Date: Wed, 8 Sep 2010 12:38:03 -0400 From: gregb...@gmail.com To: tutor@python.org Subject: Re: [Tutor] sort problem On Wed, Sep 8, 2010 at 11:50 AM, Roelof Wobben wrote: > Subject: Re: [Tutor] sort problem > From: evert@gmail.com > Date: Wed, 8 Sep 2010 17:26:58 +

Re: [Tutor] sort problem

2010-09-08 Thread Greg
On Wed, Sep 8, 2010 at 11:50 AM, Roelof Wobben wrote: > > > > Subject: Re: [Tutor] sort problem > > From: evert@gmail.com > > Date: Wed, 8 Sep 2010 17:26:58 +0200 > > CC: tutor@python.org > > To: rwob...@hotmail.com > > > > >

Re: [Tutor] sort problem

2010-09-08 Thread Francesco Loffredo
On 08/09/2010 17.50, Roelof Wobben wrote: > Subject: Re: [Tutor] sort problem > From: evert@gmail.com > Date: Wed, 8 Sep 2010 17:26:58 +0200 > CC: tutor@python.org > To: rwob...@hotmail.com ... > > seq2 = list(seq) > > seq2.sort() > > print seq2 &

Re: [Tutor] sort problem

2010-09-08 Thread Roelof Wobben
> Subject: Re: [Tutor] sort problem > From: evert@gmail.com > Date: Wed, 8 Sep 2010 17:26:58 +0200 > CC: tutor@python.org > To: rwob...@hotmail.com > > > I have this : > > > > def sort_sequence(seq): > > """ > &

Re: [Tutor] sort problem

2010-09-08 Thread Evert Rol
> I have this : > > def sort_sequence(seq): > """ > >>> sort_sequence([3, 4, 6, 7, 8, 2]) > [2, 3, 4, 6, 7, 8] > >>> sort_sequence((3, 4, 6, 7, 8, 2)) > (2, 3, 4, 6, 7, 8) > >>> sort_sequence("nothappy") > 'ahnoppty' > """ >if type(seq) == type([]):

[Tutor] sort problem

2010-09-08 Thread Roelof Wobben
Hello, I have this : def sort_sequence(seq): """ >>> sort_sequence([3, 4, 6, 7, 8, 2]) [2, 3, 4, 6, 7, 8] >>> sort_sequence((3, 4, 6, 7, 8, 2)) (2, 3, 4, 6, 7, 8) >>> sort_sequence("nothappy") 'ahnoppty' """ if type(seq) == type([]):