Getting Started with Python (iv)

Source: Internet
Author: User
Tags bitwise

python operators and operator precedence

1. Operators

    1. * * Power operation
    2. The integer part of the quotient
    3. ~ Take counter
1 #Coding=utf-82 #operator3A=10%44B=10//45 Printa6 Printb7 #Press as with "&", bitwise OR "|", Bitwise XOR or "^"8C=7&189 PrintCTen #7->00000111 One #18->00010010 AD=7|18 - PrintD -E=7^18 the Printe - #Bitwise Flip "~", (~18+1) -F=~18 - PrintF + #"<<" shift left, N units to the left is the equivalent of multiply 2^n -G=2<<3 + Printg A #">>" shift right, divided by 2^n atH=18>>2 - PrintH

2. Operator Precedence

    1. function call, addressing, subscript
    2. Power operation * *
    3. flip operation ~
    4. " Span style= "FONT-SIZE:16PX; font-family: ' Microsoft Yahei '; " > sign
    5. *,/,%
    6. +,-
    7. <<, >>
    8. &, ^, |
    9. comparison operator
    10. logical not, and/or
    11. lambda expression

2016-04-13 10:38:03

Getting Started with Python (iv)

Related Article

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.