Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. word_list = ['Juventus', 'Milan', 'Roma', 'Inter-Milan', 'Napoli', 'Fiorentina']
  2.  
  3. # Using loop
  4. length_list = []
  5. for word in word_list:
  6. length_list.append(len(word))
  7.  
  8. print(length_list)
  9.  
  10. # With map function
  11. print(list(map(len, word_list)))
  12.  
  13. # With list comprehensions
  14. print([len(w) for w in word_list])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement