TOCPython LiteralString LiteralBytes Literal Draft for Information Only
ContentPython Numeric Literal
Python Numeric LiteralPython supports numeric literals of integers, floating point numbers, and imaginary numbers. Complex literal is formed by adding a real number and an imaginary number. Besides, numeric sign is not included in numeric literal, but numeric sign '-' or '+' is considered as an unary operatorInteger LiteralAn integer literal is a sequence of ASCII characters.Definition of Integer LiteralThe definition of integer literal is: integer::=decinteger | bininteger | octinteger | hexinteger decinteger::=nonzerodigit (["_"] digit)* | "0"+ (["_"] "0")* bininteger::="0" ("b" | "B") (["_"] bindigit)+ octinteger::="0" ("o" | "O") (["_"] octdigit)+ hexinteger::="0" ("x" | "X") (["_"] hexdigit)+ nonzerodigit::="1"..."9" digit::="0"..."9" bindigit::="0" | "1" octdigit::="0"..."7" hexdigit::=digit | "a"..."f" | "A"..."F"Features of IntegerLeading zeros in a non-zero decimal number are not allowed. The length of integer literal is unlimited and is only limited by available memory. Therefore, long integer type is no longer necessary. UnderscoresPython Integer CataloguePython integer can be divided into![]() ![]() ![]() ![]() Floating Point LiteralA floating point literal is a sequence of characters for representing an floating point number with an integer part, a fractional part, and an exponent part.Definition of Floating Point LiteralThe definition of floating point literal is: floatnumber::=pointfloat | exponentfloat pointfloat::=[digitpart] fraction | digitpart "." exponentfloat::=(digitpart | pointfloat) exponent digitpart::=digit (["_"] digit)* fraction::="." digitpart exponent::=("e" | "E") ["+" | "-"] digitpartFeatures of Floating PointLeading zeros in a floating point literal are allowed because the integer and exponent parts are always interpreted using radix 10. The allowed range of floating point literals is implementation-dependent. UnderscoresPython Floating Point Catalogue![]() Imaginary LiteralAn imaginary literal is a sequence of characters for representing an imaginary number of the imaginary part of a complex number.Definition of Imaginary LiteralThe definition of imaginary literal is: imagnumber::=(floatnumber | digitpart) ("j" | "J")Features of ImaginaryAn![]() Source and Reference
©sideway ID: 210100004 Last Updated: 1/4/2021 Revision: 0 Latest Updated Links
![]() ![]() ![]() ![]() ![]() |
![]() Home 5 Business Management HBR 3 Information Recreation Hobbies 8 Culture Chinese 1097 English 339 Travel 18 Reference 79 Computer Hardware 254 Software Application 213 Digitization 37 Latex 52 Manim 205 KB 1 Numeric 19 Programming Web 289 Unicode 504 HTML 66 CSS 65 SVG 46 ASP.NET 270 OS 431 DeskTop 7 Python 72 Knowledge Mathematics Formulas 8 Set 1 Logic 1 Algebra 84 Number Theory 206 Trigonometry 31 Geometry 34 Calculus 67 Engineering Tables 8 Mechanical Rigid Bodies Statics 92 Dynamics 37 Fluid 5 Control Acoustics 19 Natural Sciences Matter 1 Electric 27 Biology 1 |
Copyright © 2000-2025 Sideway . All rights reserved Disclaimers last modified on 06 September 2019