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 337 Reference 68 Computer Hardware 151 Software Application 203 Digitization 25 Latex 29 Manim 160 Numeric 19 Programming Web 285 Unicode 504 HTML 65 CSS 59 ASP.NET 194 OS 391 DeskTop 7 Python 56 Knowledge Mathematics Formulas 8 Algebra 30 Number Theory 206 Trigonometry 18 Geometry 18 Calculus 67 Engineering Tables 8 Mechanical Rigid Bodies Statics 92 Dynamics 37 Fluid 5 Control Acoustics 19 Natural Sciences Electric 27 Biology 1 |
Copyright © 2000-2021 Sideway . All rights reserved Disclaimers last modified on 06 September 2019