1.7 Python Basics-numeric types

Source: Internet
Author: User

One, int type (arbitrary precision integer)

An integral type (int) is a data type that represents an integer. Unlike other computer languages with precision restrictions, Python's integer digits can be any length of bits (limited to computer memory only)

A numeric string is an integral type constant.

The Python interpreter automatically creates an int type object instance.

A numeric string is usually interpreted as a decimal (base 10) number.

Integral type constant

Number system Prefix Basic Digital Example
Decimal (base 10) 0~9 0,1,2,7,999,-12,+12
Hexadecimal (base 16) 0x or 0X

0~9 and A~f (or a~f)

0x0,0x1,0x7,0x3e7

Octal (base 8) 0o or 0O 0~7 0o0,0o1,0o2,0o7,0o1747
Binary (base 2) 0b or 0 B 0,1 0b0,0b1,0b10,0b111,0b1100011

Type float (limited precision floating point number)

Floating-point types (float) are data types that represent real numbers.

Type of decimal (high precision floating point number)

Know

Iv. Types of fraction (fractions)

Know

V. Type of complex (plural)

Know

1.7 Python Basics-numeric types

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.