Ch10 Variable scope has confusing variable name

未关闭 适合新手
#196 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

@chennesy 已经在做这个了。

开始于 2026年10月7日。

  • #197 来自 @chennesy —— 未关闭

评估

难度
1/5
预计耗时
1 小时以内
新手友好度
88/100
Issue 类型
文档
描述清晰度
描述清楚
活跃度
活跃
技术栈
python
领域
documentation

调研方向

在课程源代码中找到第10章的变量作用域剧集(在仓库中搜索 calc_fine 或 initial_fine 以找到准确的Markdown文件)。应用issue中提出的重命名,使 days_overdue 保持为天数统计,结果拥有独立的名称。当剧集中不再有参数的重新赋值、渲染后的示例一致且没有其他旧模式的残留时,视为完成。

由索引模型根据 Issue 内容生成。

描述

How could the content be improved?

Ch0 Variable scope section has this code:

initial_fine = 0.25
late_fine = 0.50

def calc_fine(days_overdue):
    if days_overdue <= 10:
        days_overdue =  days_overdue * initial_fine
    else:
        days_overdue = (days_overdue * initial_fine) + (days_overdue * late_fine)
    return days_overdue

There are two different uses of days_overdue, one of which would be measured in days, and one of which would be measured in dollars (pounds for us!). It would be better as something like:

def calc_fine(days_overdue):
    if days_overdue <= 10:
        total_fine =  days_overdue * initial_fine
    else:
        total_fine = (days_overdue * initial_fine) + (days_overdue * late_fine)
    return total_fine
Which part of the content does your suggestion apply to?

Ch10 Variable scope

主要语言
HTML
星标
25
派生
65
PR 合并指标
30 天内没有已合并 PR

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

LibraryCarpentry/lc-python-intro 的其他 Issue

查看 LibraryCarpentry/lc-python-intro 的全部 Issue

相似的 Issue

更多 Documentation Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。