Practical Programming
An Introduction to Computer Science
Using Python 3
(Pragmatic Programmers)
(Pragmatic Bookshelf)
Paul Gries (著) Jennifer Campbell (著)
Jason Montojo (著) Lynn Beighley (編集)
開発環境
- OS X Mavericks - Apple(OS)
- Emacs (CUI)、BBEdit - Bare Bones Software, Inc. (GUI) (Text Editor)
- Python 3.4 (プログラミング言語)
Practical Programming: An Introduction to Computer Science Using Python 3 (Pragmatic Programmers) (Paul Gries (著)、Jennifer Campbell (著)、Jason Montojo (著)、Lynn Beighley (編集)、Pragmatic Bookshelf)のChapter 8(Storing Collections of Data Using Lists)、8.9(Exercises) 5-a, b, c, d.を解いてみる。
8.9(Exercises) 5-a, b, c, d.
コード(BBEdit)
sample5.py
#!/usr/bin/env python3 #-*- coding: utf-8 -*- print('a.') alkaline_earth_metals = [4, 12, 20, 38, 56, 88] print(alkaline_earth_metals) print('b.') print(alkaline_earth_metals[5]) print(alkaline_earth_metals[-1]) print('c.') print(len(alkaline_earth_metals)) print('d.') print(max(alkaline_earth_metals))
入出力結果(Terminal, IPython)
$ ./sample5.py a. [4, 12, 20, 38, 56, 88] b. 88 88 c. 6 d. 88 $
0 コメント:
コメントを投稿