# 今日分享（三十八）——python学习（5）

Share interests, spread happiness, increase knowledge,

and leave a good legacy!

Dear you, this is The LearningYard Academy.

Today Xiaobian brings you todays sharing (thirty eight), welcome your visit!

03:29来自LearningYard学苑

1、整数类型

Among them, pow(x,y) is a built-in function of the Python language that calculates the power of y of x.

2、浮点数类型

3复数类型

18世纪，数学家发明了“虚数单位”，记为j,并规定j=√-1，产生了数学分支。In the 18th century, mathematicians invented the “imaginary unit”, denoted as j, and stipulated that j = √-1, giving rise to the branch of mathematics.复数可以看作二元有序实数对（a,b）表示 a+bj，a为实部，用z.real获得；b为虚部，用z.imag获得。Complex numbers can be seen as binary ordered real number pairs (a,b) representing a+bj, a is the real part, obtained with z.real, and b is the imaginary part, obtained with z.imag.复数类型中实数部分和虚数部分的数值都是浮点类型。The numeric values of both the real and imaginary parts of the complex number type are floating-point types.二、数字运算操作符1、内置运算操作符

Inconsistent with other languages in Python is that when “divided”, integer division is a floating-point type, so there will be a “//” for integer division.

（1）整数之间运算，如果数学意义上的结果是小数，结果是浮点数。

（2）整数之间运算，如果数学意义上的结果是整数，结果是整数。

（3）整数和浮点数混合运算，输出结果是浮点数。

（4）整数或浮点数与复数运算，输出结果是复数。

(1) Operations between integers, if the result in the mathematical sense is a decimal, the result is a floating-point number.(2) Operations between integers, if the result in the mathematical sense is an integer, the result is an integer.(3) Integer and floating-point numbers are mixed, and the output result is a floating-point number.(4) Integer or floating-point numbers and complex number operations, the output result is complex numbers.

2、内置运算函数

Numeric operation operators can implicitly convert the numeric type of the output result, for example, a division of two integers with the operator “” will likely output a floating-point result.

The built-in numeric type conversion function allows you to explicitly convert between numeric types. When a floating-point number type is converted to an integer type, the fractional part is discarded (no rounding is used), the complex number cannot be converted directly to other number types, and the real or imaginary parts of the complex number can be converted separately through .rcal and .imag.

Thats it for todays sharing.