Returning a List

Shiva shivaji_tn at yahoo.com
Fri Oct 3 07:35:38 EDT 2014


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.




More information about the Python-list mailing list