I. python data type conversion

To understand data type conversion in python.

First of all, we need to know the thing type(), which helps us to see the data type of the variable.

What it puts in () is the variable name of the variable you want to check.

Then it’s how to convert data types

converting data types in python is actually quite simple.

To convert to an integer, it’s ——int()

To convert to floating point, it’s —–float()

To convert to a character type, it’s —–str()

() is still the variable name, there are no other methods? The author also temporarily do not know, dog.jpg

Second, python’s common operators

Let’s set a X and Y it, so better example

arithmetic operators.

Add: X + Y Subtract: X – Y Multiply: X * Y Multiply: X * * Y

The formula for division is ——X/Y=A—-B (X divided by Y equals A remainder B. Note that if this division is not correct, leave me a message)

In python

X/Y means X divided by Y (in c, this is an integer division, don’t get it wrong)

X//Y means X divides Y (this is equivalent to A of the above)

X%Y means that X is the remainder of Y (this is equivalent to asking for B)

Comparison operators.

greater than: X>Y less than: X<Y equal to: X==Yp

greater than or equal to: X>=Y less than or equal to: X<=Y not equal to: X!=Y

Note: Here this comparison out of the value, the return is boolean type yo (that is, True or False)!

Logical operators.

and: X and Y or: X or Y non-: X not Y

(This is actually according to the English language, no one can not even read these three words, it will not, it will not!

With the value operator.

X=Y will Y operator to X

X+=Y equivalent to X=X+Y X+Y operator to X

-= *= /= **= (These four and the above is a meaning, I will not say more.) (Actually, I’m too lazy to type =. =)

Third, the end

The data type conversion and common operators in python are roughly the same, what do not understand can be seen in the comments area to reply to me, I see if I can answer will try to help you answer. This is about it, the next one will talk about the program control process.Python