跳至主要內容

02-Python初识数据类型「明轩」

AI悦创原创1v1Python 1v1少儿编程一对一1v1Python 1v1少儿编程一对一大约 3 分钟...约 992 字

回放云盘链接:https://www.aliyundrive.com/s/7CVjni4oR8Popen in new window

66-明轩
https://www.aliyundrive.com/s/7CVjni4oR8P
点击链接保存,或者复制本段内容,打开「阿里云盘」APP ,无需下载极速在线查看,视频原画倍速播放。

你好,我是悦创。

image-20230105151052210
image-20230105151052210

数字型「int」

代码示例
image-20230105151343988
image-20230105151343988
a = 1
t = type(a)
print(t)

print(type(a))
<class 'int'>
<class 'int'>
a = 1.1
t = type(a)
print(t)

print(type(a))
<class 'float'>
<class 'float'>

字符串「str」

代码示例
image-20230105151730624
image-20230105151730624
s = "Hello AndersonHJB"
t = type(s)
print(t)

print(type(s))

列表「list」

代码示例
lst = [1, 2, 3, 4, 1.1, "aiyc"]
print(lst)

print(type(lst))

输出:

[1, 2, 3, 4, 1.1, 'aiyc']
<class 'list'>

元祖「tuple」

代码示例
tup = (1, 2, 3, 4, 1.1, "aiyc", "look")
print(tup)

print(type(tup))

输出:

(1, 2, 3, 4, 1.1, 'aiyc', 'look')
<class 'tuple'>

字典「dict」

代码示例
d = {"name": "Mingxuan", "age": 18, "gender": "M", 19: "lll"}
print(type(d))

print(d)

输出:

<class 'dict'>
{'name': 'Mingxuan', 'age': 18, 'gender': 'M', 19: 'lll'}

集合「set」

代码示例
s = {1, 2, 3, "aiyc", (1, 2, 3), 19}
print(type(s))

print(s)

输出:

<class 'set'>
{1, 2, 3, 19, 'aiyc', (1, 2, 3)}

布尔型「bool」

代码示例
image-20230110135544335
image-20230110135544335
公众号:AI悦创【二维码】

AI悦创·编程一对一

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

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

方法一:QQopen in new window

方法二:微信:Jiabcdefh

上次编辑于:
贡献者: AI悦创,AndersonHJB
你认为这篇文章怎么样?
  • 0
  • 0
  • 0
  • 0
  • 0
  • 0
评论
  • 按正序
  • 按倒序
  • 按热度