Self-hing Artificial intelligence--python operators and manipulating objects

Source: Internet
Author: User
Tags arithmetic operators bitwise bitwise operators logical operators

The following 7 types of operators are supported in Python:

1. Arithmetic operators:

+ (plus),-(minus), * (multiply),/(except),% (remainder), * * (Power): Returns the Y power of X,//(DIVISIBLE): Returns the integer part of the quotient

2. Comparison operator: (returns a Boolean value)

= = (equals),! = (not equal to),> (greater than),< (less than), >= (greater than or equal), <= (less than or equal)

3. Assignment operators:

= (simple assignment operator), + = (addition assignment operator): C+=a, equivalent to c=c+a,-= (subtraction): Same usage as addition operator, *= (multiplication),/= (division),%= (modulo assignment operator), **= (power assignment operator),//= (rounding assignment operator)

4. Logical operators:

and (Boolean and, and): If X is False,x and y is false, otherwise the computed value of y is returned, or (boolean "or"): Returns True,not (boolean "non") if one of the criteria is reached: False if X is True

5. Bitwise operators:

&: (bitwise operator): If the two corresponding bits of the two values participating in the operation are 1, the result of that bit is 1: otherwise 0

|: (bitwise OR operator) as long as the corresponding two bits have one of 1, the result bit is 1

^: (bitwise XOR OR operator) when two corresponding bits differ, the result is 1

~: (bitwise inverse operator) for each binary inverse of the data, which turns 1 to 0 and 0 to 1

<<: (left movement operator) all bits of the operand are left shifted by the number of digits specified by the << right, high drop, low 0

6. Member Operators:

In: Returns True if a value is found in the specified sequence, otherwise it returns false

Not in: Returns True if no preference is found in the specified sequence, otherwise false

7. Identity operator:

is: Determines whether two identifiers are referenced from an object

is not: Used to determine whether two identifiers are referenced from different objects

Self-hing Artificial intelligence--python operators and manipulating objects

Contact Us

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.