【小白从小学Python、C、Java】
【Python-计算机等级考试二级】
【Python-数据分析】
Python中tuple()函数的用法
选择题
以下Python代码输出有误的是哪个选项?
a = [0,1,2,3]
b = range(0,4)
c = '0123'
d = {'a':1,'b':'2','c':[1,2]}
print("type(a):",type(a))
print("tuple(a)=",tuple(a))
print("type(tuple(a)):",type(tuple(a)))
print("==========================")
print("type(b):",type(b))
print("tuple(b)=",tuple(b))
print("type(tuple(b)):",type(tuple(b)))
print("==========================")
print("type(c):",type(c))
print("tuple(c)=",tuple(c))
print("type(tuple(c)):",type(tuple(c)))
print("==========================")
print("type(d):",type(d))
print("tuple(d)=",tuple(d))
print("type(tuple(d)):",type(tuple(d)))
A选项:tuple(a)输出元组(0,1,2,3)
B选项:tuple(b)输出元组(0,1,2,3)
C选项:tuple(c)输出元组('0','1','2','3')
D选项:tuple(d)输出元组('a','1','b','2','c','1','2')
正确答案:D
欢迎大家转发,一起传播知识和正能量,帮助到更多人。期待大家提出宝贵改进建议,互相交流,收获更大。辛苦大家转发时注明出处(也是咱们公益编程交流群的入口网址),刘经纬老师共享知识相关文件下载地址为:https://liujingwei.cn
温馨期待
期待大家提出宝贵建议,互相交流,收获更大,助教:lxy