Python-5-認識型別

1.整數- int (只要沒有小數點的都是整數)

2.浮點數-float(有小數點的都是浮點數)

3.字串-str(使用單引號或雙引號)

1.整數(int)

整數就是整數,不再區分整數與長整數

int 型別

price = 500

print(type(price))

price = 50000000000000000000000000000

print(type(price))

price = -12345678900

print(type(price))

 

 

2.浮點數-float(有小數點的都是浮點數)

#浮點數(float)
price = 7.930
print(type(price))
price = 8.00000000
print(type(price))
price = -1238.2220
print(type(price))

3.字串-str(使用單引號或雙引號)

price = "價錢"

print(type(price))

price = '價錢'

print(type(price))

 

 

 

Yiru@Studio - 關於我 - 意如