例題 1 · プログラム・アルゴリズム
Python 3で x=4; x=x+3 を順に実行した後、xは?
答えと解説を読む
正解:7
右辺では代入前の4を使い、4+3の結果7を新たなxに代入します。
この例題の出典
- 3. An Informal Introduction to Python — Python 3.14.8 documentation
3.1.1 assignment; original trace; 3.1.2 immutable strings; 3.1.2 indexing; 3.1.2 slicing; original trace; 3.1.3 assignment aliasing; original trace; 3.1.3 len; 3.1.3 shallow slice copy; original trace; 3.2 comparisons; 3.2 indentation; 3.2 truth values of sequences; 3.2 while; 3.2 while; original trace; Introduction comments
出典確認日:2026-10-05 - 自作例の独立導出
各IDの自作例を逐次追跡した導出。外部事実は別referenceを使用。
出典確認日:2026-10-05 · 独自作成・導出の記録