# 02-初识数据类型「精卫」

AI悦创原创1v1Python 1v11v1Python 1v1大约 3 分钟...约 823 字

## 2. 数字型「int、float」

``````num = 1
print(type(num))

t = type(num)
print(t)
``````

``````<class 'int'>
<class 'int'>
``````
``````num = 1.111
print(type(num))

t = type(num)
print(t)
``````

``````<class 'float'>
<class 'float'>
``````

## 3. 字符串「str」

``````s = "Hello Zhaojinwei"
print(type(s))

print(s)
``````

``````<class 'str'>
Hello Zhaojinwei
``````

## 4. 列表「list」

``````lst = [1, 2, 3, 4, 1.1, "aiyc"]
print(lst)
``````

``````[1, 2, 3, 4, 1.1, 'aiyc']
``````

## 5. 元组「tuple」

``````tup = (1, "aiyc", 1.1, "look")
print(tup)
print(type(tup))
``````

``````(1, 'aiyc', 1.1, 'look')
<class 'tuple'>
``````

## 6. 字典「dict」

``````d = {"name": "zhaojinwei", "age": 19, "gender": "F", 19: "number", (1, 2, 3): "tup", True: "Bool"}
print(d)
print(type(d))

d = {
"name": "zhaojinwei",
"age": 19, "gender": "F",
19: "number"
}
``````

## 8. 布尔型「bool」

AI悦创·编程一对一

AI悦创·推出辅导班啦，包括「Python 语言辅导班、C++ 辅导班、java 辅导班、算法/数据结构辅导班、少儿编程、pygame 游戏开发、Web、Linux」，全部都是一对一教学：一对一辅导 + 一对一答疑 + 布置作业 + 项目实践等。当然，还有线下线上摄影课程、Photoshop、Premiere 一对一教学、QQ、微信在线，随时响应！微信：Jiabcdefh

C++ 信息奥赛题解，长期更新！长期招收一对一中小学信息奥赛集训，莆田、厦门地区有机会线下上门，其他地区线上。微信：Jiabcdefh

• 0
• 0
• 0
• 0
• 0
• 0

• 按正序
• 按倒序
• 按热度