Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Does python have a short type?
Does python have a short type?
Python numeric data types are used to store numeric values.

Python supports three different number types: int, float and complex.

In other programming languages, such as Java and C, there are also long types and short types. Python, on the other hand, has only int types, but no long and short types.

Related recommendation: Python tutorial

Integer:

It is usually called an integer, which is an integer or a negative number without a decimal point. Python3 integer types have no size limit. Integer: 0, 10 -780, -089, -0x270, 0x90.

Floating-point type:

A floating-point type consists of an integer part and a decimal part. Floating point numbers: 0.0, 15.2, -2.9,--32.5e 10/0,32+e18.

Floating-point numbers can be expressed by scientific calculation: 2.5e2 = 2.5x 10 2 = 250.

Complex type:

Complex number consists of real part and imaginary part, which can be expressed by a+bj or complex number (a, b). The real part A and imaginary part B of a complex number are both floating-point types. Complex: 3. 14j, 9.23e-35j, 4.53e-7j.

Python number type conversion

Int(x) converts x into an integer.

Float(x) converts x into a floating point number.

Complex(x) converts x into a complex number, with the real part being x and the imaginary part being 0. Complex(x, y) converts x and y into complex numbers, where the real part is x, the imaginary part is y, and x and y are numerical expressions.