Im aware that we are able to get the frequency of characters in a string by doing this:
def freq_of_chars(string):
all_freq = {}
for i in string:
if i in all_freq:
all_freq[i] += 1
else:
all_freq[i] = 1
print("Count of all characters is: " + str(all_freq))
freq_of_chars('Test')
However, if i want to get the frequency of characters in more then 1 string, how do i do it? I tried this but the output shows the frequency count of each word instead of characters.
def freq_of_chars(string1,string2):
freq = {}
for i in string1,string2:
if i in freq:
freq[i] += 1
else:
freq[i] = 1
print("Count of all characters is: " + str(freq))
freq_of_chars('First','Second')