自律学習手法と Python エンジニアリング基礎 480 分(8 時間の集中学習)

第 1 日:診断、学習法と環境

診断、予測・実験・振り返り、検索練習、概念分解と検証済みターミナル環境を使います。既存の変更例は共有トレーサーバレットであり、重複させません。

90 min 独立習得確認 (Independent Mastery Check)。予測と観測出力を記録した後に受ける支援は復習・修復のみに限定し、このチェックの AI 完了を意味しません。評価対象の説明文は必ず無支援で作成し、支援による復習後は新たな独立チェックで再確認してから習得を申告します。

学習手法、極小再現、および予測-実験-振り返りの実践

前提条件

高校レベルの読解力とターミナル操作の基礎知識。高度な Python 構文の事前知識は不要です。

学習目標

既存のミューテーション・トレーサー教材で、診断セルフチェックと「予測-実験-振り返り」ループを実践する:コード実行前に予測結果を記録し、実行後に差異を分析し、極小再現例(MRE)と根本原因仮説を導出したうえで、概念を名前・オブジェクト・ミューテーション・割り当て・証拠に分解する。

手順

プログラミングやモデルのデバッグにおいて、推測の繰り返しや無秩序なプロンプト入力は根本的な理解不足を覆い隠してしまいます。本アクティビティでは、変数の可変性と参照に関する典型的な課題を対象に、「予測-実験-振り返り」のサイクルを実践します。

演習と予測記録

以下の Python コードを観察し、実行する前に下部の入力欄に予想される出力を記述してください:

a = [1, 2, 3]
b = a
b.append(4)
c = a + [5]
print('Case 1:', a)
print('Case 2:', c)
print('Case 3:', a is b, a is c)

予測完了後、なぜ b.append(4) は a を変更し、a + [5] は a を変更しないのかを分析してください。さらに極小再現例(MRE)として、b と a が同一オブジェクトを参照していることを示す短い証人スニペットを記述してください。これは予期せぬ挙動への対処だけでなく、同一性の主張を裏付ける証拠なので、予測がすべて正しくても必須です。

Day 01 客観的診断クイズ: オブジェクト参照とインプレース変更

以下の設問に解答して理解度を確認してください。提出前に利用した補助条件を誠実に申告してください。

申告補助条件

注記: AI不使用は誠実な申告条件であり、監視や強制検知ではありません。

1.

コード a = [1, 2, 3]; b = a; b.append(4) を実行した後の a の最終的な値は何ですか?

2.

続けて c = a + [5] を実行した場合、式 a is c の評価結果はどうなりますか?

3.

Pythonにおける代入文 b = a の基礎メカニズムとして正確な説明はどれですか?

解答根拠と履歴

    学習プロジェクト提出と証拠

    注意:貼り付けられた実行ログやメモは自己申告の証拠であり、独立した検証や自動テスト結果を構成するものではありません。

    0 / 4096 bytes
    申告された支援条件

    注:AIなしでの作業は誠実な申告条件であり、監視ではありません。

    現在提出されている証拠の詳細

    提出記録はまだありません。
    独立習得基準:

    習得基準:外部AIの補助に頼ることなく、破壊的変更と新規割り当ての違いを正確に予測し、予測・実測・原因究明を含む3段階の診断ログに加え、極小の同一性/ミューテーション証人スニペット(MRE)を自力で記述できること。MREは予測結果に関わらず必須とする。

    公式ソースリソースと権利証跡

    リンク参照(合法的外部参照・未許可インポートなし) PSF License Version 2

    Pythonデータモデルとミュータビリティ公式リファレンス

    著者・提供機関: Pythonソフトウェア財団 (Python Software Foundation) | オリジナル出所URL ↗

    該当セクション・タイムスタンプ: 第3.1節および第3.2節(オブジェクト、値、型)

    検証バージョンと日付: Python 3.12 公式ドキュメント(検証日: 2026-10-30)

    選定理由:

    Pythonのオブジェクト同一性、参照、ミュータブル/イミュータブルに関する厳密な公式仕様であり、不正確な二次解説を排除するため選定。

    ソース前提知識:

    基本的なターミナル操作の基礎知識および高校レベルの読解力

    安全フォールバック(オフライン回復性):

    外部接続が遮断された場合でも、ローカルの pydoc および本教材内の完全な解説・演習コードによりオフラインで学習を完結できます。

    比較対象候補リソースと選定評価 (4)
    MIT OCW 6.0001 (Prof. Eric Grimson) ↗ 比較検討(Day 01では不採用) [CC BY-NC-SA 4.0]

    計算論的思考の講義として優れているが、即時の最小再現コード(MRE)検証よりも伝統的な講義進行に重点があるため見送り。

    Stanford CS336: Language Modeling from Scratch (Spring 2024) ↗ 比較検討(後続フェーズで採用) [No license declared (the repository has no LICENSE file, so all rights are reserved by default)]

    言語モデルのスクラッチ実装において卓越した深度を持つが、PyTorchとGPU環境を前提とするためDay 30-60へ延期。

    3Blue1Brown: 線形代数の本質 ↗ 比較検討(後続フェーズで採用) [3Blue1Brown copyright (all rights reserved); site FAQ permits only short clips under stated conditions]

    幾何学的直観に秀でており、Day 10-18の数学基礎で採用。Day 01の参照学習には含めず。

    Andrej Karpathy: micrograd ↗ 比較検討(後続フェーズで採用) [MIT (Repository) / Standard YouTube License (Video)]

    自動微分の実装解説として最適。コードはMITライセンスだが動画字幕の再配布権が不明なため全文翻訳インポートは禁止し、Day 19-25にて合法リンクとして活用。

    オプション動画リソース(利用不能でも学習は遮断されません)

    注記:外部のオプション動画リソースは利用不可です。教材本文、自律演習、ヒント、習得基準は完全なオフライン環境で動作します。

    120 min 自律的習得確認 (Independent Mastery Check)

    Python 環境構築・ターミナル操作と仮想環境の分離

    前提条件

    一般的なOSでのターミナル実行権限。

    学習目標

    空のサンドボックスディレクトリにクリーンな Python 3.12+ 仮想環境を作成し、`sys.prefix`、`sys.executable`、`python -m pip` でインタプリタとパッケージの分離を検証する。

    手順

    評価は POSIX シェル(Linux/macOS の bash または zsh)で行います。仮想環境が有効化されていない新しいターミナルで開始してください — 開始前プローブが True を示すことを確認し、報告された実行パスと prefix を記録します。Windows の対応コマンドは末尾に示しますが、本教材では未実行です。

    python3 --version
    python3 -c "import sys; print(sys.executable); print(sys.prefix); print(sys.base_prefix); print(sys.prefix == sys.base_prefix)"
    mkdir venv-sandbox && cd venv-sandbox
    printf 'marker\n' > marker.txt
    python3 -m venv .venv
    . .venv/bin/activate          # bash/zsh; cmd.exe and PowerShell differ (below)
    echo "$VIRTUAL_ENV"
    python -c "import sys; print(sys.executable); print(sys.prefix); print(sys.base_prefix); print(sys.prefix == sys.base_prefix)"
    python -c "print(open('marker.txt').read().strip())"
    python -m pip --version
    deactivate
    python3 -c "import sys; print(sys.executable); print(sys.prefix); print(sys.base_prefix); print(sys.prefix == sys.base_prefix)"

    期待される不変条件:
    - python3 --version が Python 3.12 以降を報告してから作業を開始する。
    - 新規シェルの開始前プローブは sys.prefix == sys.base_prefix が True と表示し、そのパスを開始前の状態として記録する。
    - 有効化後、$VIRTUAL_ENV は .venv を指し、sys.executable は .venv 内を示し、sys.prefix が .venv パスと一致する一方 sys.base_prefix は基底インストールを指し続ける — この不一致が分離の検証。sys.executable は呼び出しパス(シンボリックリンクの可能性あり)を示すため、物理実行ファイルの解決ではなく prefix の値で確認する。
    - venv インタプリタ自身が marker.txt を読み marker を出力する:venv の Python は .venv 外・作業ディレクトリ内のファイルを読める — 分離はインタプリタ/パッケージであり、ファイルシステムのサンドボックスではない。
    - python -m pip --version は .venv の site-packages 内の pip を報告する。python -m pip で pip が有効なインタプリタと対になる。
    - deactivate 後の終了プローブは開始前に記録した値と一致する(sys.prefix == sys.base_prefix が再び True)。

    Windows の対応コマンド(本教材では未実行の参考手順):py -m venv .venv で作成、.venv\Scripts\Activate.ps1(PowerShell)または .venv\Scripts\activate.bat(cmd.exe)で有効化。診断は PowerShell では $env:VIRTUAL_ENV、cmd.exe では %VIRTUAL_ENV%、コマンド検索は command -v/echo $PATH の代わりに where.exe python。deactivate、python -c、sys.prefix/sys.base_prefix チェックは共通です。

    対応する Python が利用できない場合は、演習内の記録フォールバックに従い、環境部分を未実施のまま習得済みとは申告しないでください。

    範囲の注意:仮想環境が分離するのは sys.prefix/sys.path を介した Python インタプリタとインストール済みパッケージです。venv の Python によるマーカー読み取りが示すとおり、ファイルシステムやセキュリティのサンドボックスではなく、内部のプログラムはファイルを読めます。Python 自体のバージョン固定でもありません。

    演習と予測記録

    仮想環境が有効化されていない新しいターミナルで作業手順を実行します:開始前プローブを記録し、新規の空ディレクトリで .venv を作成・有効化し、echo $VIRTUAL_ENV、venv 内プローブ、venv インタプリタによる marker.txt の読み取り、python -m pip --version を記録し、deactivate 後に終了プローブが開始前の記録と一致することを確認します。python3 --version が失敗するか 3.12 未満を報告した場合、規定の環境は達成不可として申告しないでください。古いインタプリタがある場合は観測バージョンを記録し、そのバージョンに限定した同じチェックを実行します。インタプリタが無い場合は command -v python3(Windows では where.exe python)、python3 --version、echo $PATH(Windows では %PATH% / $env:PATH)と観測エラーを記録し、Python のインストールを復習タスクとして予定してください。未実行の環境タスクは習得の証拠になりません。

    独立習得基準:

    仮想環境の無い新規シェルで、新規ディレクトリ内の 作成→有効化→検証→無効化 を自力で実行し、venv 内プローブで `sys.prefix != sys.base_prefix` と `python -m pip` の `.venv` 内解決、`marker.txt` 読み取りによる非サンドボックス実証、および終了プローブの開始前記録との一致を含む記録を提示できること。加えて、インタプリタ分離とファイルシステム/セキュリティサンドボックスの違いを1行で正しく説明できること。対応 Python が無い場合はこの部分の習得を申告せず、記録済みフォールバック証拠と復習タスクを代わりに提示します。

    公式ソースリソースと権利証跡

    linking PSF License Version 2

    The Python Tutorial: Virtual Environments and Packages

    著者・提供機関: Python Software Foundation | オリジナル出所URL ↗

    該当セクション・タイムスタンプ: Section 12 (creating venvs, pip installs, requirements files)

    検証バージョンと日付: Python 3.12 (Verified: 2026-10-30)

    選定理由:

    Primary reference for python -m venv and interpreter isolation, which the Day 01 drill checks through activation, the sys.prefix/sys.base_prefix probes, and python -m pip --version; its requirements-file and wrong-environment material is practiced later, on Study Day 11.

    ソース前提知識:

    Basic Python syntax from Study Days 01-09

    安全フォールバック(オフライン回復性):

    The Day 01 drill needs no network: venv creation and activation, the sys.executable/sys.prefix/sys.base_prefix probes, the venv interpreter's marker.txt read, python -m pip --version, and deactivate all run offline; without a supported Python, the exercise's recorded no-interpreter fallback applies.

    比較対象候補リソースと選定評価 (2)
    pip documentation ↗ compared_alternative [MIT]

    Primary reference for pip commands, but the tutorial presents the create-activate-install loop as one beginner-friendly narrative.

    virtualenv documentation ↗ compared_alternative [MIT License]

    Mature third-party environment tool with overlapping behavior; the stdlib venv tutorial was selected to avoid an extra dependency for first-time setup.

    linking PSF License Version 2

    Python Standard Library: pathlib

    著者・提供機関: Python Software Foundation | オリジナル出所URL ↗

    該当セクション・タイムスタンプ: Path.exists, Path.cwd, and anchoring paths to __file__

    検証バージョンと日付: Python 3.12 (Verified: 2026-10-30)

    選定理由:

    Background reference for working-directory-relative file access: the Day 01 drill's venv interpreter reads marker.txt from the current directory using open(), not pathlib; Path.exists()/Path.cwd() evidence that separates an absent file from a wrong working directory is practiced on Study Day 10.

    ソース前提知識:

    Basic Python syntax from Study Days 01-09

    安全フォールバック(オフライン回復性):

    Not needed to complete the Day 01 drill, which makes no pathlib call, so no online page is required; Path.exists() and Path.cwd() are exercised offline on Study Day 10.

    比較対象候補リソースと選定評価 (2)
    os.path documentation ↗ compared_alternative [PSF License Version 2]

    Functionally equivalent for exists() checks; pathlib keeps the beginner syntax object-oriented and consistent across the block.

    shutil — High-level file operations ↗ compared_alternative [PSF License Version 2]

    Covers copying and moving whole trees rather than path modeling; pathlib remains the right reference for the filesystem checks these days rehearse.

    150 min 自律的習得確認 (Independent Mastery Check)

    Git の基礎:リポジトリ初期化、コミットと状態確認

    前提条件

    基本的なファイルコマンド(mkdir, cd, ls)と `git --version` が動作すること。

    学習目標

    使い捨ての Git リポジトリを自力で初期化し、変更→ステージ→コミット→ログ確認の一巡を、各段階で `git status`、`git diff`、`git log` により検証する。

    手順

    評価対象タスク(独立実施):以下の一連の作業を、新規作成した使い捨てディレクトリ内で自力で行います。本プロジェクトや既存の作業ツリー内では絶対に実行しないでください。破壊的コマンド(reset --hard、clean、push --force)は使用しません。作者情報が無くコミットに失敗した場合は、示した方法でそのリポジトリ内にのみ設定します。

    mkdir git-sandbox && cd git-sandbox
    git init
    git config user.name "Learner"
    git config user.email "[email protected]"
    printf 'first line\n' > notes.txt
    git status
    git add notes.txt
    git diff --cached
    git commit -m "Add notes file"
    printf 'second line\n' >> notes.txt
    git status
    git diff
    git add notes.txt
    git commit -m "Append a second line to notes"
    git log --oneline
    git status

    期待される不変条件:
    - git add 前の git status は notes.txt を未追跡(untracked)として示し、ステージ後の git diff --cached は + 始まりの新規行を示す。
    - 変更後、git status/git status --porcelain はファイルを未ステージの変更( M)として示し、git diff がその未ステージ差分を表示する。
    - git log --oneline は2件のコミットを新しい順に列挙し、最後の git status はクリーンな作業ツリーを報告する。
    - --global を付けない git config user.name/user.email はこのリポジトリの .git/config にのみ書き込まれ、マシン全体の設定は変更されない。

    各コマンドと観測出力をログに記録してください。

    任意・評価外のオリエンテーション(本チェックの対象外):後で使う Agent ツールを Agent Tool Track ページで確認しても構いません。これは見学のみで、本独立習得確認の一部でも証拠でもありません。

    演習と予測記録

    新規の空ディレクトリで上記のコマンド列をすべて実行してください。評価対象の成果物は、notes.txt の 未追跡→ステージ済み→コミット済み の遷移、2回目の 変更→ステージ→コミット サイクル、および2件を列挙する最終 git log --oneline を示すコマンドと出力の記録です。加えて、status に関する観察を1件記録してください。git status が報告した内容で予期しなかった点、または予期しない点がなかった場合は、予期どおりの状態遷移を1つ挙げ、その実際の出力と、その出力がなぜ予測を裏付けるかを説明してください。生の予測と生の出力はそのまま記録してください。

    独立習得基準:

    使い捨てディレクトリ内で、既存のリポジトリ状態・破壊的コマンド・エージェント支援なしに、新規リポジトリの初期化→ファイル変更→ステージ→ステージ差分の確認→コミット→`git log --oneline` による2件確認→クリーンな `git status` までの全工程を自力で実行できること。

    公式ソースリソースと権利証跡

    linking CC BY-NC-SA 3.0 noncommercial share-alike

    Pro Git, Second Edition

    著者・提供機関: Scott Chacon and Ben Straub | オリジナル出所URL ↗

    該当セクション・タイムスタンプ: Chapter 3 (Git Branching), Section 7.7 (Reset Demystified), Sections 5.2/6.2 (Contributing to a Project)

    検証バージョンと日付: Second edition (Apress, 2014) (Verified: 2026-10-30)

    選定理由:

    Freely licensed reference for branching, merging, conflict resolution, and safe recovery vocabulary used on Day 14.

    ソース前提知識:

    Basic git status/log/diff vocabulary from earlier study days

    安全フォールバック(オフライン回復性):

    git help <command> and the Git manual pages ship with Git and cover the same commands offline; every required workflow is stated locally in the lesson.

    比較対象候補リソースと選定評価 (2)
    GitHub Skills interactive courses ↗ compared_alternative [MIT (varies by course)]

    Interactive but requires a GitHub account and an external service; disposable local repositories keep the exercise self-contained.

    Atlassian Git Tutorials ↗ compared_alternative [All Rights Reserved]

    Vendor-owned prose with no permissive license; Pro Git covers the same ground under CC BY-NC-SA.

    120 min 自律的習得確認 (Independent Mastery Check)

    第 1 日の振り返り:想起練習と学習ログの作成

    前提条件

    本日の最初のアクティビティ3件を完了していること。

    学習目標

    閉巻で今日の主要概念を自分の言葉で書き出し、1つの誤解を根拠により修正する(誤解が見つからなかった場合は、その旨を明示した上で、ありがちな誤解を1つ根拠付きで棄却する)、そして具体的な復習ステップを予定する想起ログを作成する。

    手順

    レッスンとノートを閉じ、支援なしで行います。
    第1段階 — 無支援の想起(参照資料は閉じた状態):今日の3系統(オブジェクト参照とミューテーション、仮想環境の分離、Git の 変更→ステージ→コミット サイクル)について、何も参照せず記憶にある内容を書き出します。
    第2段階 — 参照確認と修正:ここで初めて参考解答を開き、想起が誤りまたは不完全だった箇所を印し、ルーブリックに従って誤解を1件扱います。第1段階の記述は上書きせず注釈し、無支援の試行が区別できるようにします。
    第3段階 — 新たな無支援チェック(再び参照資料を閉じる):修正または想起した概念を新しい小さな事例に適用し(新しいコードの出力予測やチェックの再導出)、結果を記録します。
    第4段階 — 短い復習ステップを予定する:Day 02 開始前に最も弱い項目を再自測する、具体的な時刻とトリガーを決めます。

    ルーブリック — ログは次の4項目すべてを満たすこと:
    - 無支援の想起段階で、少なくとも2つの Day 01 概念をコピーではなく自分の言葉で再述している
    - 実際の誤解1件を修正した具体的根拠と対で記録するか、見つからなかった場合は「見つからなかった」旨を明示した上で、あり得る一般的な誤解1つを根拠つきで棄却する
    - 第3段階の新たな無支援の転用/想起チェックを結果とともに記録している(「全部正しかった」だけの申告は何も立証しない)
    - 具体的な時刻とトリガーを伴う復習ステップが1つ予定されている
    分量は証拠ではありません。ルーブリックを満たす短いログは、長い要約より優れます。

    演習と予測記録

    手順で説明した想起ログを作成してください:まず無支援で想起し、次に参照確認による修正(または「見つからなかった」旨の明示的な代替)、新たな無支援チェック、復習ステップの予定まで行います。

    独立習得基準:

    ルーブリックの全項目を満たす閉巻の想起ログを作成できること:自分の言葉で再述した Day 01 の概念2つ以上;具体的根拠で修正された実際の誤解1件、または見つからなかった場合の明示記録と根拠つきで棄却した一般的誤解;結果を記録した新たな無支援の転用チェック;予定された復習ステップ1つ。語数・文字数や根拠のない正答申告は概念習得の証拠ではありません。

    公式ソースリソースと権利証跡

    linking Journal publisher copyright (all rights reserved) - lawful external linking only

    Test-Enhanced Learning: Taking Memory Tests Improves Long-Term Retention

    著者・提供機関: Henry L. Roediger III, Jeffrey D. Karpicke | オリジナル出所URL ↗

    該当セクション・タイムスタンプ: Psychological Science 17(3): 249-255, Experiments 1-2

    検証バージョンと日付: Psychological Science, 2006 (Verified: 2026-10-30)

    選定理由:

    Foundational experimental evidence that retrieval practice (testing) outperforms repeated study for long-term retention; grounds the Day 88 AI-free retrieval checks in peer-reviewed learning science rather than folk advice.

    ソース前提知識:

    Basic understanding of study sessions, retention intervals, and experimental design vocabulary.

    安全フォールバック(オフライン回復性):

    The curriculum restates the experimental design and effect sizes in original prose; every sealed task runs without the paper.

    比較対象候補リソースと選定評価 (2)

    Strong meta-analytic coverage of spacing effects but addresses scheduling rather than the retrieval effect itself; retained as support for the Day 90 spaced-review schedule.

    Equally foundational follow-up demonstrating repeated retrieval vs repeated study; the 2006 paper is cited as the standard first controlled demonstration.

    linking Journal publisher copyright (all rights reserved) - lawful external linking only

    Improving Students' Learning With Effective Learning Techniques: Promising Directions From Cognitive and Educational Psychology

    著者・提供機関: John Dunlosky, Katherine A. Rawson, Elizabeth J. Marsh, Mitchell J. Nathan, Daniel T. Willingham | オリジナル出所URL ↗

    該当セクション・タイムスタンプ: Psychological Science in the Public Interest 14(1): 4-58; practice testing and distributed practice sections

    検証バージョンと日付: Psychological Science in the Public Interest, 2013 (Verified: 2026-10-30)

    選定理由:

    Detailed comparative review rating practice testing and distributed practice as high-utility techniques while rating highlighting and rereading low-utility; anchors the retrieval, correction, and spaced-review design of Days 88-90.

    ソース前提知識:

    None beyond general academic reading.

    安全フォールバック(オフライン回復性):

    Curriculum restates the utility ratings and application conditions in original prose; every task remains runnable offline.

    比較対象候補リソースと選定評価 (2)
    Pashler et al. Learning Styles: Concepts and Evidence ↗ compared_alternative [Publisher copyright (originally Wiley; now SAGE Publications)]

    Important negative result on learning-styles matching but narrower scope; Dunlosky et al. rates a broader set of techniques directly usable for this curriculum.

    Brown, Roediger & McDaniel: Make It Stick: The Science of Successful Learning ↗ compared_alternative [Publisher copyright (Harvard University Press)]

    Strong trade-book synthesis of the same evidence base; the peer-reviewed review is preferred for citation precision and technique-by-technique utility ratings.