In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Today's article is to share with you some cloud computing development tutorials, today is about: Python data type numbers.
A variable is a value stored in memory, which means that a space is opened up in memory when the variable is created.
Computers are used to assist human beings, and the classification of the display world is also mapped in programming to facilitate abstract analysis.
Based on the data type of the variable, the interpreter allocates the specified memory and determines what data can be stored in memory.
Therefore, variables can specify different data types, and these variables can store integers, decimals, or characters
PYTHON has five standard data types:
Numbers (digital)
String (string)
List (list)
Tuple (tuple)
Dictionary (dictionary)
Numeric type
It is used to store values and is an immutable data type.
Changing the digital data type allocates a new object.
Creation of numeric type objects:
When you specify a value, the Number object is created:
Var1 = 1
Var2 = 10
Use the Del statement to delete references to some objects
The syntax of the del statement is:
Del var1 [, var2 [, var3 [...., varN]
For example:
Del var
Del var_a, var_b
Python supports four different number types:
Int signed integer
Long long integer [can also represent octal and hexadecimal] L (python3.5 is no longer available)
Float floating point type
Complex complex number
Some examples of numeric types:
| | int | long | float | complex |
| | 10 | 51924361L | 0.0 | 3.14j |
| | 100 |-0x19323L | 15.20 | 45.j |
| |-786 | 0122L |-21.9 | 9.322e-36j |
| | 080 | 0xDEFABCECBDAECBFBAEl | 32.3+e18 .876j |
|-0490 | 535633629843L |-90. -.65450J
| |-0x260 |-052318172735L |-3.254e+89 trillion 3e+26J |
| | 0x69 |-4721885298529L | 70.2-E12 4.53e-7j |
Long integers can also use lowercase "L", or uppercase "L" is recommended to avoid confusion with the number "1".
Python also supports complex numbers, which are made up of real and imaginary parts, which can be represented by a + bj or complex (aforce b). Both the real part an and the imaginary part b of the complex number are floating point.
The range represented by the integer Int (2.0):
-2147483648 to 2147483647
-2 times 31 to 2 years 31-1
Test:
> num=2147483647
> type (num)
> num=2147483648
> type (num)
The range represented by the long integer Long (2. 0):
Very large, almost any large integer can be stored
Artificially define long integers:
> num=123L / / add L after the integer
> type (num)
Floating point Float:
> > frank12
> > type (f)
> > fallow 12.0
> > type (f)
Plural type:
Applied to system analysis, signal analysis, quantum mechanics, relativity, applied mathematics, fluid mechanics, fragmentation
> > jackers 3.12
Type (j)
Jroom3.12j / / add j to the original number
Type (j)
Bool type:
Strictly speaking, the bool type is the bool type
Bool (Boolean)
True or false
1 or 0
True or False
> axi1room1
> > a
True
> a=bool (1)
> > a
True
> a=bool (1 percent = "1")
> > a
False
> > type (a)
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.