2014年5月21日水曜日

開発環境

Head First Python (Paul Barry(著)、 O'Reilly Media; )のChapter 1(meet python - Everyone loves lists)、Exercise(p.13)を解いてみる。

Exercise(p.13)

コード(BBEdit)

sample13.py

#!/usr/bin/env python3
#-*- coding: utf-8 -*-

movies = ["The Holy Grail", "The Life of Brian", "The Meaning of Life"]

movies.insert(1, 1975)
movies.insert(3, 1979)
movies.insert(5, 1983)

movies1 = ["The Holy Grail", 1975, "The Life of Brian", 1979,
           "The Meaning of Life", 1983]

print(movies)
print(movies1)

入出力結果(Terminal)

$ ./sample13.py .
['The Holy Grail', 1975, 'The Life of Brian', 1979, 'The Meaning of Life', 1983]
['The Holy Grail', 1975, 'The Life of Brian', 1979, 'The Meaning of Life', 1983]
$

0 コメント:

コメントを投稿