Python development "Chapter two": Python operators

Source: Internet
Author: User

1. Arithmetic Operation:

2. Comparison operation:

3. Assignment Operation:

4. Logical Operation:

5. Member Arithmetic:

6, identity operation:

7, bit operation:

#!/usr/bin/pythona= 60#= 0011 1100b = 13#= 0000 1101c =0 C= A & B;#0000 1100Print "Line 1-value of C is", c c= A | b#1101 = 0011Print "Line 2-value of C is", c c= a ^ b;#0001 = 0011Print "Line 3-value of C is", c c= ~a;#-61 = 1100 0011Print "Line 4-value of C is", c c= a << 2;#0000 = 1111Print "Line 5-value of C is", c c= a >> 2;#= 0000 1111Print "Line 6-value of C is"+ D
View Code

8, Operator Precedence:

Click here for more information: Python operator

Python development "Chapter two": Python operators

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.