Home
Iron Pythonで遊ぶ
Iron Python
Iron Python入門
WPF/XAMLを使おう
Information
私の本棚
Column
コラム
組み込み関数 divmod
divmod(a, b)
2 つの (複素数でない) 数値を引数にして、商と剰余のペアとなるタブルを返します。
#coding: shift-jis
a = divmod(11,9)
print a
print a[0]
print a[1]
b = divmod(11.0,9) ←浮動小数点型は浮動小数点型で返します。
print b
raw_input()
出力画面:
(1, 2)
1
2
(1.0, 2.0)