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 摘要。