2014年12月18日木曜日

開発環境

Introducing Python: Modern Computing in Simple Packages(Bill Lubanovic (著)、 O'Reilly Media)のChapter 4(Py Crust: Code Structures)、Things to Do 4.4.を解いてみる。

Things to Do 4.4.

コード(BBEdit)

sample4.py

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

print([n for n in range(10) if n % 2 == 0])

入出力結果(Terminal, IPython)

$ ./sample4.py
[0, 2, 4, 6, 8]
$

0 コメント:

コメントを投稿