Python Base value operator

Source: Internet
Author: User

First, arithmetic operators

The arithmetic operators have the following types:

-: Subtraction

*: Multiplication

/: Division, which is the real division, the result shows the number of decimal parts

%: Take-over, two-digit division of the remainder

* *: power operation, e.g. 3**2 result of 9

: In addition to the floor, the results show only the whole number of parts

Second, comparison operators

Comparison operators have the following concentrations:

= =: equals

! =: Not equal, recommended use

<>: Not equal to, Python3 has been abandoned

: Greater Than

<: Less than

>=: greater than or equal to

<=: Less than or equal to

Three, assignment operators

The assignment operators have the following types of values:

=: The simplest assignment, such as a=2

+=:a+=2, equivalent to a=a+2

-=:a-=2, equivalent to A=a-2

*=:a*=2, equivalent to A=a*2

/=:a/=2, equivalent to A=A/2

%=:a%=2, equivalent to a=a%2

**=:a**=2, equivalent to A=a**2

=:a//=2, equivalent to A=A//2

Four, logical operators

There are several logical operators:

And: Logic and, only the two sides of the conditions are set up, and finally set up. For example true and true result is true,true and false result is false

Or: Logical OR, both sides of the condition as long as one side is established, and finally set up. For example true or false result is true

Not: logical non, conditional negate. For example not true result is false,not false result is true

Priority: Not>and>or

Python Base value operator

Related Keywords:
Related Article

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

• Sales Support

1 on 1 presale consultation

• After-Sales Support

24/7 Technical Support 6 Free Tickets per Quarter Faster Response

• Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.