Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #78645

Returning a List

From Shiva <shivaji_tn@yahoo.com>
Subject Returning a List
Date 2014-10-03 11:35 +0000
Newsgroups comp.lang.python
Message-ID <mailman.14573.1412336152.18130.python-list@python.org> (permalink)

Show all headers | View raw


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)
  d= b+c
  print('d = ',d)

  #return b+c
  return d

front_x(['bbb', 'ccc', 'axx', 'xzz', 'xaa'])



Why is return d or return b+c not returning anything??

The d's value is confirmed by the print statement.

Thanks,
Shiva.

Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Returning a List Shiva <shivaji_tn@yahoo.com> - 2014-10-03 11:35 +0000
  Re: Returning a List Larry Hudson <orgnut@yahoo.com> - 2014-10-03 19:21 -0700

csiph-web