2014年6月30日月曜日

開発環境

Practical Programming: An Introduction to Computer Science Using Python 3 (Pragmatic Programmers) (Paul Gries (著)、Jennifer Campbell (著)、Jason Montojo (著)、Lynn Beighley (編集)、Pragmatic Bookshelf)のChapter 2(Hello, Python)、2.10-7.を解いてみる。

2.10-7.

コード(BBEdit)

入出力結果(Terminal, IPython)

$ ipython
Python 3.4.1 (default, May 21 2014, 01:39:38) 
Type "copyright", "credits" or "license" for more information.

IPython 2.1.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: a
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-1-60b725f10c9c> in <module>()
----> 1 a

NameError: name 'a' is not defined

In [2]: a + b
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-2-f96fb8f649b6> in <module>()
----> 1 a + b

NameError: name 'a' is not defined

In [3]: b + a
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-3-a50d69c311c0> in <module>()
----> 1 b + a

NameError: name 'b' is not defined

In [4]: b
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-4-3b5d5c371295> in <module>()
----> 1 b

NameError: name 'b' is not defined

In [5]: quit()
$

0 コメント:

コメントを投稿