Python基本輸入+邏輯判斷+強制型態轉換
Python基本輸入+邏輯判斷+強制型態轉換
# -*- 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) #基本輸入+邏輯判斷+強制型態轉換 num = raw_input(“Now enter a number:”) num1=(int(num)*1)#強制型態轉換 print (“10<%s = %s” %(num,(10<num1))) |