開発環境
- OS X Mavericks - Apple(OS)
- Emacs (CUI)、BBEdit - Bare Bones Software, Inc. (GUI) (Text Editor)
- Python 3.4 (プログラミング言語)
Learning Python (Mark Lutz (著)、Oreilly & Associates Inc)のPART Ⅱ.(Types and Operations)、Test Your Knowledge: Part II Exercises 2.(Indexing and slicing)を解いてみる。
その他参考書籍
2.(Indexing and slicing)
入出力結果(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]: L = [0,1,2,3] In [2]: L[4] # error --------------------------------------------------------------------------- IndexError Traceback (most recent call last) <ipython-input-2-66c34860db04> in <module>() ----> 1 L[4] # error IndexError: list index out of range In [3]: L[-1000:100] # [0, 1, 2, 3] Out[3]: [0, 1, 2, 3] In [4]: L[3:1] # [] Out[4]: [] In [5]: L[3:1] = ['?'] In [6]: L # [0, 1, 2, '?', 3] Out[6]: [0, 1, 2, '?', 3] In [7]: quit() $
0 コメント:
コメントを投稿