Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- word_list = ['Juventus', 'Milan', 'Roma', 'Inter-Milan', 'Napoli', 'Fiorentina']
- # Using loop
- length_list = []
- for word in word_list:
- length_list.append(len(word))
- print(length_list)
- # With map function
- print(list(map(len, word_list)))
- # With list comprehensions
- print([len(w) for w in word_list])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement