Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/DasyDong/developer-roadmap
/ count_str
Function
count_str
code/run_comp.py:37–42 ·
view source on GitHub ↗
定义一个字符出现次数的函数
(str_data)
Source
from the content-addressed store, hash-verified
35
36
37
def
count_str(str_data):
38
""
"定义一个字符出现次数的函数"
""
39
dict_str = {}
40
for
i in str_data:
41
dict_str[i] = dict_str.get(i, 0)+1
42
return
dict_str
43
44
45
def
test_count_str():
Callers
1
test_count_str
Function · 0.85
Calls
no outgoing calls
Tested by
1
test_count_str
Function · 0.68