2014年6月27日金曜日

開発環境

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-4, a, b, c.を解いてみる。

2.10-4, a, b, c.

入出力結果(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]: (6 * 3) + (7 * 4) # a
Out[1]: 46

In [2]: 6 * 3 +  7 * 4
Out[2]: 46

In [3]: 5 + (3 / 4) # b
Out[3]: 5.75

In [4]: 5 + 3 / 4
Out[4]: 5.75

In [5]: 5 - (2 * (3 ** 4)) # c
Out[5]: -157

In [6]: 5 - 2 * 3 ** 4
Out[6]: -157

In [7]: quit()
$

0 コメント:

コメントを投稿