Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the Python number types?

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly talks about "what are the digital types of Python". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "what are the Python digital types"?

I. figures

The number types in Python include:

Integer number

Floating point number

Complex number

Fixed precision decimal number

Rational fraction

Set

Boolean type

Infinite integer precision

Various digital built-in functions and modules

Second, built-in mathematical tools

Expression operator:

Operator description yield generator function delivery protocol lambda args:expression generates anonymous functions x if y else z ternary expression x or y logic or (there is a short circuit algorithm) x and y logic and (there is a short circuit algorithm) not x logic non x in x not in y membership x is ydepartment x is not y object entity test x comparison size x | y bit OR, set union x ^ y bit XOR, set symmetry difference x ^ y bit and The set intersection xy moves to the left or to the right, merging and deleting x quotient, x% y, and so on, multiplies the remainder, divides, divides the floor, divides, subtracts, divides, subtracts, divides, divides Call function x.attr calls attribute () tuple, expression, generator [] list, list parsing {} dictionary, collection, collection and dictionary parsing.

Built-in mathematical function

Math

Function | constant indicates instance e natural constant emath.e

2.718281828459045

Inf default value: inf

Nan default value: nan

Pi pi π math.pi

3.141592653589793

Tau6.283185307179586

Acos (x) returns the inverse triangular cosine of x math.acos (math.sqrt (2) / 2)

0.7853981633974483

Acosh (x) returns the inverse hyperbolic cosine function of x

Asin (x) returns the inverse trigonometric sine of x math.asin (0.5)

0.5235987755982989

Asinh (x) returns the inverse hyperbolic sine function of x

Atan (x) returns the inverse trigonometric tangent of x math.atan (1.7320508075688767)

1.0471975511965976

Atan2 (y, x) returns the anti-trigonometric tangent value math.atan2 (2prime1) of xCompy.

1.1071487177940904atanh (x) returns the inverse hyperbolic tangent function of x

The method of ceil (x) rounded up math.ceil (5.2) for I

6.0

Copysign (x, y) if y

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report