Home  >  Article  >  Backend Development  >  Detailed explanation of numbers in Python

Detailed explanation of numbers in Python

零下一度
零下一度Original
2017-07-19 23:34:001238browse

This article mainly introduces the number types and basic mathematical calculations in Python. Like other languages, division is relatively complicated. However, this article does not go into depth. Friends who need it can refer to Python not only supports common data types. (integers and floating-point numbers), and can directly create numbers and expressions that process numbers through constants.

The complete toolset for Python number types includes:

  • Integers and floating point numbers

  • Complex numbers

  • Fixed precision decimal number

  • Rational fraction

  • Set

  • Boolean Type

  • Infinite integer precision

  • Various numeric built-in functions and models

Python3. Starting with 0 (zero)

Python's complex constants are written as real part + imaginary part, where the imaginary part ends with j or J. Among them, the real part is technically optional, but all numerical operations on complex numbers will be performed according to the arithmetic rules of complex numbers. Complex numbers can also be created through the built-in function complex(real,imag).

Python provides a series of numerical object tools:

Expression operators: +, -, *, /, >>, **, &, etc.

Built-in mathematical functions: pow, abs, round, int, hex, bin, etc.

Public modules: random, math, etc.

The above is the detailed content of Detailed explanation of numbers in Python. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:python sequence listNext article:python sequence list