Python 數值/邏輯運算 [和C/C++ 一樣]
資料來源: https://github.com/stormzhang/free-programming-books/blob/master/assets/python/Python%E6%A0%B8%E5%BF%83%E7%BC%96%E7%A8%8B%EF%BC%88%E4%B8%AD%E6%96%87%E7%AC%AC%E4%BA%8C%E7%89%88%EF%BC%89%E5%B8%A6%E7%9B%AE%E5%BD%95.pdf 的p36~p38
# -*- coding: UTF-8 -*-
#數值運算
print (-2 * 4 + 3 ** 2)#=> (-2*4)+3^2=1
#邏輯運算
print (2 < 4)
print (2 == 4)
print (2 > 4)
print (6.2 <= 6)
print (6.2 <= 6.2)
print (6.2 <= 6.20001)
print (6.2 != 6.20001)
|