You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
10 lines
249 B
Python
10 lines
249 B
Python
5 years ago
|
def char_frequency(str1):
|
||
|
dict = {}
|
||
|
for n in str1:
|
||
|
keys = dict.keys()
|
||
|
if n in keys:
|
||
|
dict[n] += 1
|
||
|
else:
|
||
|
dict[n] = 1
|
||
|
return dict
|
||
|
print(char_frequency('google.com'))
|