Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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"
- def alphaOrder(students):
- mylist = []
- splitter = students.split(',')
- for i in splitter:
- mylist.append(i)
- mylist.sort(key=lambda n: split(' ')[1])
- print(mylist)
- alphaOrder(students)
- res = sorted(students.split(','), key=lambda x: x.split()[1])
- ['Jane Bee janebee@gmail.com 555-555-5555',
- 'John Dee johndee@gmail.com 555-555-5555',
- 'Sarah Zee sarahzee@gmail.com 555-555-5555']
Add Comment
Please, Sign In to add comment