開発環境
- 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)、Chapter 8.(Lists and Dictionaries)、Test Your Knowledge: Quiz 1.を解いてみる。
その他参考書籍
Test Your Knowledge: Quiz 1.
コード(BBEdit)
sample1.py
#!/usr/bin/env python3 #-*- coding: utf-8 -*- l1 = [0, 0, 0, 0, 0] l2 = [] l2.append(0) l2.append(0) l2.append(0) l2.append(0) l2.append(0) l3 = [0 for x in range(5)] l4 = [0] * 5 print(l1, l2, l3, l4, sep='\n')
入出力結果(Terminal, IPython)
$ ./sample1.py [0, 0, 0, 0, 0] [0, 0, 0, 0, 0] [0, 0, 0, 0, 0] [0, 0, 0, 0, 0] $
0 コメント:
コメントを投稿