0
Dictionary
how do I get data from a string and make it a dictionary so that it looks like this {letters, number of duplicate letters}
3 Réponses
+ 6
A python solution
message = " This is a small message designed 2 test the following count functions.\n\n These functions will count the number of words within this message, count all the letters, then break down the letters into consonants & vowels, and identify capital & lower case letters.\n\n Special characters, (punctuation, paranthesis, etc) are also counted.\n\n Why don't you test this against your own input? "
#txt = message.split() # words
txt = message # letters
a = {key:txt.count(key) for key in txt}
print(a)
+ 3
use Counter Collection in python
it will count amount of each letter in the string
+ 1
Tq