Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #count duplicte values from list
- letters = ['a','b','c','a','d','c','d','c','a'] #list with duplicate values
- list_string = ' '.join([str(elem) for elem in letters]) #convert the list to string join them by space
- #count each letter/values of set-list from converted string
- for lt in set(letters):
- print('lt : '+lt+' '+str(list_string.count(lt)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement