June 2026
Intermediate
804 pages
8h 21m
Japanese
インストール方法は「1章 入門」を参照すること。
print(42)と入力せよ。詳細は「1章 入門」で説明されている。インタプリタは自分についての情報を数行出力してから、先頭が>>>になっている行を出力する。これがPythonコマンドを入力するプロンプトである。
次のような結果になる。
$ python Python 3.14.2 [version info] Type "help", "copyright", "credits" or "license" for more information. >>> print(42) 42
43と入力せよ。次のような結果になる。ここではインタプリタ特有の動作が現れている点に注目する。
>>> 43 43
7をさまざまな名前の変数に代入せよ。また、不正な名前も試して、表示されるエラーメッセージを確認せよ。回答例は無数にあるが、例えば以下の通り。
>>> number = 7
>>> number
7
>>> Lucky = 7
>>> Lucky
7
>>> 7isluckynumber = 7
<stdin>:1: SyntaxWarning: invalid decimal literal
File "<stdin>", line 1
7isluckynumber = 7
^^^^^^^^^^^^^
SyntaxError: invalid syntax
Read now
Unlock full access