python There are four types of numbers ：

Integers int

floating-point float

Boolean boolen

The plural complex

>>> type(5)
<class 'int'>
>>> type(True)
<class 'bool'>
>>> type(3.2)
<class 'float'>
>>> type(2.3-4.6j)
<class 'complex'>

Boolean value （True False） Or and not （or and not）

data type ：

number Numbers   1

string character string   ""

list list   []

tuple Yuan Zu   ()

dictionary Dictionaries   {}

Variable assignment

>>> a=b=c=1
>>> a
1
>>> b
1
>>> c
1
>>> a,b,c=1,2,"three"
>>> a
1
>>> b
2
>>> c
'three'
>>> a=1
>>> b=2
>>> c=3
>>> d=4
>>> a,b=c,d
>>> a
3
>>> b
4
>>> c
3
>>> d
4

>>> a=12
>>> id(a)# Look at the memory address of the variable
1481010544
>>> a=23
>>> id(a)
1481010896

# Reference assignment （ Same memory address ）

>>> a=1000
>>> id(a)
57192176
>>> b=a
>>> id(b)
57192176

# Greater than 256 The memory address of the number is different
>>> a=1000
>>> b=a
>>> a is b
True
>>>
>>>
>>> a=1000
>>> b=1000
>>> a is b
False

# Arithmetic operations

>>> 2+3
5
>>> 2-1
1
>>> 2*2
4
>>> 6/2
3.0
>>> 6//2# Integer division
3
>>> 5//3
1
>>> 8%5# Remainder
3
>>> 2**3
8

# Logical operations

>>> 1&3# Bit and
1
>>> 1|3# Bit or
3
>>> ~1# Take the opposite
-2
>>> 1^3# Bitwise XOR
2
>>>

Comparison relation operation

==,！=,<>,>=,<=,>,<

The assignment operation ：

=,+=,-=,*=,/=,//=,%=

Members of the operation ：

in,not in

Identity operation ：

is,is not

Python Learning notes --- Count data type More articles on Computing

1. Python Learning notes - day3 - Data types and operators

Python Data type of A computer, as its name suggests, is a machine that can do mathematical calculations , therefore , Computer programs can, of course, handle all kinds of values . however , Computers can handle more than numbers , You can also work with text . graphics . Audio . video . Web pages and all kinds of data , Different ...

2. python Learning notes ： data type —— list / Array （list）

Python One of the built-in data types is list :list.list It's an orderly collection , You can add and remove elements at any time . The elements in the list are accessed by subscripts ( Also called index . Corner marker ), Subscript from 0 Start counting .list Definition , Use brackets []. l ...

3. python Learning notes ： data type —— Numbers 、 character string 、 Yuan Zu 、 Dictionaries

A computer, as its name suggests, is a machine that can do mathematical calculations , therefore , Computer programs can, of course, handle all kinds of values . however , Computers can handle more than numbers , You can also work with text . graphics . Audio . video . Web pages and all kinds of data , Different data , You need to define different numbers ...

4. python Data types of learning notes （ Two ）

Last blog , Wavelet introduces python Introduction and simple process control , Write this time python Data types and built-in methods for various data types . One . Where is the data type ? A computer, as its name suggests, is a machine that can do mathematical calculations , therefore , A computer program is right ...

5. python Study note 2 data type （ The basic chapter ）

Python Basics about Python, Everything is an object , Objects are created based on classes         Different types of classes can create strings , Numbers , Objects like lists , such as "koka".24.[' Beijing ', ' On ...

6. Python Learning notes 3_ data type

Python data type : Numbers . character string . list . Yuan Zu . Dictionaries One . Numeric type :( integer . Long integer . floating-point . Plural ) 1. integer (int): Scope of representation -2,147,483,648 To 2,147,483,647 2. Long integer ( ...

7. 02 Python Learning notes - Basic data type ( Two )

One . Basic knowledge 1. Indent : 2. Multiple statements on one line : 3. Line breaks : 4. notes # Single-line comments ''' This is a paragraph. Multiline comment ''' 5. Variable 1. Variable type ( local variable . Global variables . System variables ) 2. Variable assignment Multiple assignments x ...

8. python Learning notes （ data type ）

python data type : int type float Decimal type string character string Boolean type a = True b = False 1. list , Also called array or list or array. It is expressed by subscript or index or ...

9. python Data types of learning notes 、 Character encoding 、 Document processing

1. data type 1. Numbers (int,float) plastic (int): Definition age=20  # The essence age=int(20) Floating point type :salary=3000.3 # The essence salary=float(3000.3) ...

Random recommendation

1. linux decompression xz package

1. download xz package http://tukaani.org/xz/xz-4.999.9beta.tar.bz2   2. Unzip the installation package \$tar -jxvf xz-4.999.9beta.tar.bz2   3 ...

2. socketserve And Its Applications

1.cmd command utilize socket socket Server side import socket import subprocess s = socket.socket() s.bind(("127.0.0 ...

3. JavaScript Code optimization （ Download time and execution speed optimization ）

JavaScript The speed of the code is divided into two parts : Download time and execution speed . Download time Web The browser downloads js Source code , So all long variable names and comments are included . This factor increases download time .1160 It's a TCP-IP The words in the bag ...

4. vue+websocket+express+mongodb Actual project （ Live chat ）

Follow up on the previous project with vuejs Imitate Netease cloud music ( Realize the function of listening to music and searching ) after , I found that the previous project only used vue Of model The management is very chaotic , Then I went to see vuex, I'm going to do a project to practice hands , I don't want to do a repetitive project , I'll give up this time ...

5. win10 How to solve the problem in the system cmd The path in is not consistent with the user name of the current computer

Suppose the original user name is Lao Wang , deleted , however cmd The back path is still C:\Users\ Lao Wang >, It's the same as today's users laowng It needs to be changed to C:\Users\laowang>. . First, create a new administrator account laowang, however ...

6. FluentData -Micro ORM with a fluent API that makes it simple to query a database 【MYSQL】

Official address :http://fluentdata.codeplex.com/documentation MYSQL: MySQL through the MySQL Connector .NET driv ...

7. ElasticSearch 2 (20) - How to start the language processing series

ElasticSearch 2 (20) - How to start the language processing series Abstract Elasticsearch Equipped with a set of language analyzers , Provide good off the shelf support for most common languages in the world . The Arabic language . Armenian , the ...

8. Using a Microsoft Account to Logon and Resulting Internet Communication in Windows 8

Using a Microsoft Account to Logon and Resulting Internet Communication in Windows 8 This topic has not been rated  -  Comment on this topic ...

9. 【 Paper notes 】 How to understand... In deep learning End to End

End to end: It means entering raw data , The output is the final result , It is applied in feature learning and integrating algorithm , No need to deal with it alone . end-to-end( end-to-end ) Methods , Input my raw data at one end , One end outputs the result I want to get . Only care about input and output ...

10. mybatis from the shallower to the deeper day01_1 course arrangement _2 On the original ecology jdbc Summary of problems in procedure

mybatis The first day mybatis Basic knowledge of 1  course arrangement : mybatis and springmvc By ordering goods Case driven The first day : Basic knowledge of ( a key , A lot of content ) On the original ecology jdbc Program ( Use alone jdbc open ...