Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #78661 > unrolled thread
| Started by | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| First post | 2014-10-03 15:07 -0400 |
| Last post | 2014-10-03 15:07 -0400 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Returning a List Terry Reedy <tjreedy@udel.edu> - 2014-10-03 15:07 -0400
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Date | 2014-10-03 15:07 -0400 |
| Subject | Re: Returning a List |
| Message-ID | <mailman.14581.1412363279.18130.python-list@python.org> |
On 10/3/2014 7:35 AM, Shiva wrote:
> Hi All,
>
> I might be doing something really silly here, but I can't seem to spot it:
>
> def front_x(words):
> b=[]
> c=[]
> for a in words:
> if a[0] == 'x':
> b.append(a)
> else:
> c.append(a)
>
> b = sorted(b)
> c = sorted(c)
Just sort in place with
b.sort()
c.sort()
> d= b+c
> print('d = ',d)
>
> #return b+c
> return d
>
> front_x(['bbb', 'ccc', 'axx', 'xzz', 'xaa'])
xlist = front_x(['bbb', 'ccc', 'axx', 'xzz', 'xaa'])
print(xlist)
--
Terry Jan Reedy
Back to top | Article view | comp.lang.python
csiph-web