2013年2月14日木曜日

開発環境

『初めてのPython 第3版』(Mark Lutz 著、夏目 大 訳、オライリー・ジャパン、2009年、ISBN978-4-87311-393-7) のIII部(ステートメント)の11章(代入ステートメント、式ステートメント、print(python3から関数))練習問題4.を解いてみる。

その他参考書籍

4.

コード(BBEdit)

sample.py

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

# True は整数1、Falseは整数0のカスタマイズ版
if True == 1:
    print("a")
else:
    print("b")
if False == 0:
    print("a")
else:
    print("b")

print(True + 10)
print(10 + True)
print(False + 10)
print(10 + False)

入出力結果(Terminal)

$ ./sample.py
a
a
11
11
10
10
$

0 コメント:

コメントを投稿