Python 3 Study Notes: Numbers and Boolean

digital

basic type

Integer

In Python programming, integer is an integer mathematical sense, including positive integers, negative integers and zero, and it is the number of bits is arbitrary. Depending on the method of representation can be divided into:

Binary integer
octal integer
decimal integer
hexadecimal integer
floating point

Float decimals in a mathematical sense, by the left of the decimal integer and fractional right side of the composition.

plural

Complex in the mathematical sense, the real and imaginary part, using j or J represents an imaginary unit. When the presentation is a complex, may be real and imaginary portions I would like to add, such as 2.67 + 12.5j

Arithmetic

In Python programming, using integer arithmetic operators and calculating the difference, product, quotient like:

Python 3 Study Notes: Numbers and Boolean

Comparison operation

Comparison operation, also known as relational operators for comparing the relationship between the left and right worthy of size, phase, etc., if the result is true, returns True, otherwise False.

Python 3 Study Notes: Numbers and Boolean

Boolean

basic type

In Python, only two boolean values: True (true) and False (false). In the process of writing code, all objects can be the true value of the test, which is only about several cases the value obtained is False:

False or None
numbers zero, or an imaginary number including 0, 0.0 0
empty columns (including strings, lists, tuples, dictionaries)
custom object instance of the object bool method returns False or len method returns 0
logic operation

In Python programming, the logic element includes, or non-

Python 3 Study Notes: Numbers and Boolean

Assignment Operators

In Python programming, using an equal sign (=) or other objects for assignment to a variable, such as:

. 1
2
. 3
X = 12 is
Y = 23 is
Z = Y + X
replication
on may be derived from the assignment of special symbols, such as:

Python 3 Study Notes: Numbers and Boolean

Basic Input Output

print()

print () output for any content that you want to export.

input()

input () to enter anything you want to enter.

Guess you like

Origin blog.51cto.com/14499640/2429603