2014年12月20日土曜日

開発環境

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

Things to Do 4.6.

コード(BBEdit)

sample6.py

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

odds = {n for n in range(10) if n % 2 != 0}

print(odds)

入出力結果(Terminal, IPython)

$ ./sample6.py
{1, 9, 3, 5, 7}
$

0 コメント:

コメントを投稿