selfteaching / selfteaching/selfteaching-python-camp
Day03 关于python代码缩进不当导致的问题
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 151
- Forks
- 875
- PR merge metrics
- No merged PRs in 30d
Description
今天在测试代码时,出现了一些问题,请看以下两段代码:
代码1:

代码2:

乍看之下一模一样,反正我是没找到区别,但就是因为缩进问题,代码2无法执行。
大家有没有碰到类似的问题,有什么好的方法,是如何避免的,一起来讨论下啊。
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
No source file or test is named. Review the two code examples in the issue images and reproduce the execution difference in Python, then compare their indentation and the Day03 lesson context. Done when the whitespace difference and a clear way to avoid it are documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- developer-experience
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100