when I pass ['bbb', 'ccc', 'axx', 'xzz', 'xaa'] as words to the below
function, it picks up only 'xzz' and not 'xaa'

def front_x(words):
  # +++your code here+++
  a = []
  b = []
  for z in words:
    if z.startswith('x'):
      words.remove(z)
      b.append(z)
      print 'z is', z
  print 'original', sorted(words)
  print 'new', sorted(b)
  print sorted(b) + sorted(words)

Thanks,
Deepti
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to