内置的type()函数可以用来查询变量所指的对象类型。 a, b, c, d = 20, 5.5, True, 4 + 3jprint(type(a), type(b), type(c), type(d))#<class 'int'> <class 'float'> <class 'bool'> <class 'complex'> 1. 2. 3. 此外还可以用isinstance来判断: a = 111isinstance(a, int)#True 1....
题目【题目】下列选项中,可作为 $$ P _ { y } $$thon变量名的是() A. int B. Abc C. float D. Complex 相关知识点: 试题来源: 解析 【解析】inl、float、Complex是三种数据类型,是 python中的关键字,不能做变量名。故选:B。 反馈 收藏 ...
There are 3 numeric data types in Python:int float complex1. Python int TypeInteger numeric type is used to store signed integers with no decimal points, like -5, 2, 78, etc.Example# Assigning integer values to Variables x = 8 y = -9 # Manipulating the value of x x = x + y #...
2))#11print(int('0o13', 8))#11print(int('0xb', 16))#11x= 1 - 2jprint(type(x))#<class 'complex'> complex复数print(x.real)#1.0 实步print(x.imag
在Python中:int(x)函数将x转换为整型,故选项A错误;char(x)函数将x转为字符型,故选项B错误;float(x)函数将x转换为浮点型,故选项C错误;complex(x)函数将x转换为复数,符合题意,选项D正确。 综上所述,本题选D选项。 阅读题干,我们可以知道,本题让我们选择Python中适合的内置函数对x进行类型转换,转换为复...
same = logical 1 Limitations The following functions, which support custom floating-point inputs, do not support complex custom floating-point inputs. ceil cosh exp fix floor ge gt hypot le log log10 log2 lt mod pow10 pow2 power rem round rsqrt sqrt tanh ...
A. int B. Abc C. float D. Complex 相关知识点: 试题来源: 解析 B [详解] 此题主要考察 Python 变量的命名。变量的命名规章有:只能以字母或下划线开头,不能包含特别符号,不能是关键字,故可作为 Python 变量名的是 Abc,故此题选 B 选项。 解析:B [详解] 此题主要考察 Python 变量的命名。变量的...
C - Expression a=b=c (Multiple Assignment) Evaluates C - Expression a==b==c (Multiple Comparison) Evaluates C - Complex Return Statement Using Comma Operator C - Comma Operator C - Bitwise Operators C - Bitwise One's Compliment C - Modulus of Float or Double Numbers C Conditional Statemen...
Built-in Types Python数值类型包括整型(integer),浮点型(floating point number)和复数(complex number),并且,布尔型(boolean)是整型的子类 其中,最常用的数值类型包括整型,浮点型和布尔型,下面介绍它们的定义和使用方法 主要内容: 整型(int)定义 浮点型(float)定义 ...
【题文】下列选项中,可作为Python变量名的是()A.intB.AbcC.floatD.Complex 答案 【答案】B【解析】【详解】本题主要考查Python变量的命名。变量的命名规则有:只能以字母或下划线开头,不能包含特殊符号,不能是关键字,故可作为Python变量名的是Abc,故本题选B选项。相关...