標籤:ccf exp open round start 機器 type python3 images
運算子
1、算數運算:
2、比較運算:
3、賦值運算:
4、邏輯運算:
5、成員運算:
1 name = "yehaoran " # in 判斷ye是否在name裡面 在的話返回ok 不在返回not 2 # if "ye" in name : 3 # print("ok") 4 # else: 5 # print("not") 6 7 if "ran" not in name: 8 print("ok") 9 else:10 print("not") # in not 判斷ran是否在不name裡面 不在的話返回ok 在返回not成員運算
基礎資料型別 (Elementary Data Type)
1、數字
int(整型)
在32位機器上,整數的位元為32位,取值範圍為-2**31~2**31-1,即-2147483648~2147483647
在64位系統上,整數的位元為64位,取值範圍為-2**63~2**63-1,即-9223372036854775808~9223372036854775807
1 # 數字 int 2 # python3裡,1111111111111122333數字多長都用int 3 # python2裡,數字太大用long小的用int 4 5 # 1、將字串轉換成數字 type 查看資料類型 6 # a = "123" 7 # print(type(a)) 8 # b = int(a ) 9 # print(type(b))10 # b = b + 10011 # print(b)12 13 14 # 2、以16進位的形式轉換成10進位15 # num = "a"16 # v = int(num, base=16)17 # print(v)18 19 20 # 3、當前數位二進位,至少用n位表示21 # # a = 12322 # # r = a.bit_length()23 # # print(r)
int幾種用法
Python基礎資料型別 (Elementary Data Type) day2