Python 代码输出结果:数据类型判断
Python 代码输出结果:数据类型判断
代码:
x = 12.34
print(type(x))
选项:
A) <class 'int'>
B) <class 'float'>
C) <class 'bool'>
D) <class 'complex'>
答案: B) <class 'float'>
解析:
变量 x 被赋值为 12.34,由于它是一个小数,因此属于浮点数类型。使用 type() 函数可以返回变量的数据类型,因此输出结果是 <class 'float'>。
原文地址: https://www.cveoy.top/t/topic/f2Bh 著作权归作者所有。请勿转载和采集!