Guest User

Untitled

a guest
Sep 10th, 2018
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. students="John Dee johndee@gmail.com 555-555-5555,Jane Bee janebee@gmail.com 555-555-5555,Sarah Zee sarahzee@gmail.com 555-555-5555"
  2.  
  3. def alphaOrder(students):
  4. mylist = []
  5. splitter = students.split(',')
  6.  
  7. for i in splitter:
  8. mylist.append(i)
  9.  
  10. mylist.sort(key=lambda n: split(' ')[1])
  11. print(mylist)
  12.  
  13. alphaOrder(students)
  14.  
  15. res = sorted(students.split(','), key=lambda x: x.split()[1])
  16.  
  17. ['Jane Bee janebee@gmail.com 555-555-5555',
  18. 'John Dee johndee@gmail.com 555-555-5555',
  19. 'Sarah Zee sarahzee@gmail.com 555-555-5555']
Add Comment
Please, Sign In to add comment