2014年7月14日月曜日

開発環境

Practical Programming: An Introduction to Computer Science Using Python 3 (Pragmatic Programmers) (Paul Gries (著)、Jennifer Campbell (著)、Jason Montojo (著)、Lynn Beighley (編集)、Pragmatic Bookshelf)のChapter 4(Working with Text)、4.7(Exercises) 1.を解いてみる。

4.7(Exercises) 1.

コード(BBEdit)

入出力結果(Terminal, 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]: 'Computer' + ' Science' # 'Computer Science'
Out[1]: 'Computer Science'

In [2]: 'Darwin\'s' # "Darwin's"
Out[2]: "Darwin's"

In [3]: 'H2O' * 3 # 'H2OH2OH2O'
Out[3]: 'H2OH2OH2O'

In [4]: 'CO2' * 0 # ''
Out[4]: ''

In [5]: quit()

Process Python finished

0 コメント:

コメントを投稿