selfteaching / selfteaching/selfteaching-python-camp
Day05用循环方式统计字符串内每个单词出现的次数
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 151
- Forks
- 875
- PR merge metrics
- No merged PRs in 30d
Description

@seven_tears张教练,用字典统计字符串内每个单词的个数,我的思路是用分割函数得到单词列表后,遍历单词列表,内嵌一个for循环遍历字典内的key,用key与每个单词比较,如果key与单词相同,key对应的值就加一,如果不同则赋值为一,并把键值对新增到字典内,最后再对字典进行打印。但我这样写,最后打印出来的是没经过处理的字典,我想应该是if语句那里出错了,但找不到具体原因
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review the Day05 exercise and the code shown in the attached image, starting with the split word list, dictionary keys, and nested loop conditions. Reproduce the result, identify why the dictionary is not updated as intended, and confirm that the final output contains the correct count for every word.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100