2014年12月19日金曜日

開発環境

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

Things to Do 4.5.

コード(BBEdit)

sample5.py

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

print({n:n*n for n in range(10)})

入出力結果(Terminal, IPython)

$ ./sample5.py
{0: 0, 1: 1, 2: 4, 3: 9, 4: 16, 5: 25, 6: 36, 7: 49, 8: 64, 9: 81}
$

0 コメント:

コメントを投稿