2013年4月1日月曜日

開発環境

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

2, 3, 4, 5, 6.

入出力結果(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.
>>> x=+5
>>> x
5
>>> x=-17
>>> +x
-17
>>> temp = 24
>>> temp = temp * 1.8 + 32
>>> temp
75.2
>>> x=10.5
>>> y=4
>>> x=x+y # x = 14.5
>>> x
14.5
>>> x=3
>>> x += x - x
>>> x
3
>>> x += x - x # x - x = 0, x += 0, x=3
>>> x
3
>>> quit()
$

0 コメント:

コメントを投稿