Advertisement
Guest User

Untitled

a guest
Dec 12th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. def format_list(my_list):
  2. length_list = len(my_list)
  3. my_list = my_list[range(length_list)][::2]
  4. last_one = my_list.pop()
  5. my_list = ', '.join(my_list)
  6. last_one = 'and ' + last_one
  7. my_list = my_list + [last_one]
  8. return(my_list)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement