Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the data types in Python

Shulou Source: shulou.com Published: 2022-06-03 14:53:12 10月14日 Update

This article mainly explains "What are the data types in Python". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let Xiaobian take you to learn "What are the data types in Python"!

Data types integers in Python

Python can handle integers of any size, including negative integers.

Common integers: written the same way, for example: 1, 100,-8080, 0.

Hexadecimal: represented by the prefix 0x and 0-9, a-f, for example: 0xff00, 0xa5b4c3d2, etc.

string

A string is any text enclosed in 'or'.

Such as 'abc',' xyz 'and so on. The string 'abc' has only three characters: a, b and c.

floating point number

Ordinary floating point numbers: written directly in mathematics, such as 1.23, 3.14,-9.01, etc.

② Scientific counting method: replace 10 with e, that is, 1.23x10^9 is recorded as 1.23e9 or 12.3e8, 0.000012 can be written as 1.2e-5

Note: Integers and floating-point numbers are stored differently inside computers. Integer operations are always accurate (division is accurate, too? Yes!), Floating-point arithmetic may be subject to rounding errors.

boolean value

① In Python, you can directly use True, False to represent Boolean values (please pay attention to case)

2 Calculated through Boolean operations.

Boolean values can be operated with and, or and not.

The and operation is an AND operation, and the result of the and operation is True only if all are True.

An or operation is an OR operation, and if either of them is True, the result of the OR operation is True.

The not operation is a NOT operation, which is a monocular operator that turns True into False and False into True.

At this point, I believe that everyone has a deeper understanding of "what are the data types in Python", so let's actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!

Tags: Operations integers data types characters Boolean point string ordinary precise content writing only size result learning different practical deeper rounded Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux vpn Huawei Shulou Tech Info NVidia