2013年3月31日日曜日

開発環境

初めてのコンピュータサイエンス(Jennifer CampbellPaul GriesJason MontojoGreg Wilson(著)長尾 高弘(翻訳))の2章(Python入門)の2.10の練習問題1を解いてみる。

1.

入出力結果(Terminal)

$ python
Python 3.3.0 (default, Sep 29 2012, 08:16:08) 
[GCC 4.2.1 Compatible Apple Clang 3.1 (tags/Apple/clang-318.0.58)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
<<< 9 - 3 # 6
6
<<< 8 * 2.5 # 20.0
20.0
<<< 9 // 2 # 4
4
<<< 9 // -2 # -5
-5
<<< 9 % 2 # 1
1
<<< 9 % -2 # -1
-1
<<< -9 % 2 # 1
1
<<< -9 % 2 # 1
1
<<< 9 / -2.0 # -4.5
-4.5
<<< 9 / -2 # -4.5
-4.5
<<< 4 + 3 * 5 # 19
19
<<< (4 + 3) * 5 # 35
35
<<< quit()
$

0 コメント:

コメントを投稿