Practical Programming
An Introduction to Computer Science
Using Python 3
(Pragmatic Programmers)
(Pragmatic Bookshelf)
Paul Gries (著) Jennifer Campbell (著)
Jason Montojo (著) Lynn Beighley (編集)
開発環境
- OS X Mavericks - Apple(OS)
- Emacs (CUI)、BBEdit - Bare Bones Software, Inc. (GUI) (Text Editor)
- Python 3.4 (プログラミング言語)
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-1.を解いてみる。
2.10-1.
入出力結果(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]: 9 - 3 # 6 Out[1]: 6 In [2]: 8 * 2.5 # 20.0 Out[2]: 20.0 In [3]: 9 / 2 # 4.5 Out[3]: 4.5 In [4]: 9 / -2 # -4.5 Out[4]: -4.5 In [5]: 9 // -2 # -5 Out[5]: -5 In [6]: 9 % 2 # 1 Out[6]: 1 In [7]: 9.0 % 2 # 1.0 Out[7]: 1.0 In [8]: 9.0 % 2 # 1.0 Out[8]: 1.0 In [9]: 9 % 2 # 1 Out[9]: 1 In [10]: 9 % 2.0 # 1.0 Out[10]: 1.0 In [11]: 9 % -2 # -1 Out[11]: -1 In [12]: -9 % 2 # 1 Out[12]: 1 In [13]: 9 / -2.0 # - 4.5 Out[13]: -4.5 In [14]: 4 + 3 * 5 # 19 Out[14]: 19 In [15]: (4 + 3) * 5 # 35 Out[15]: 35 In [16]: quit() $
0 コメント:
コメントを投稿