Python expressions and operators 19

Source: Internet
Author: User

Python expressions and operators 19
1. Expression operators commonly used in python 1. arithmetic Operations x * y, x/y, x/y, x % y x + y, x-y 2. logical operation: x or y, x and y, not x 3. member relationship calculation: x in y, x not in y 4. object instance test: x is y, x not is y 5. comparison: x <y, x> y, x <= y, x> = y, x = y, x! = Y 6. bitwise operation: x | y, x & y, x ^ y, x <y, x> y 7. unary operation:-x, + x ,~ X (bitwise inversion) 8. power Operation: x ** y 9. indexes and shards: x [I], x [I: j], x [I: j: stride] 10. call operation: x (...) 11. property: x. attribute 12. tuples :(...) 13. sequence: [...] 14. dictionary :{...} 15. ternary selection expression: x if y else z 16. anonymous function: lambda args: expression 17. generator function sending protocol: yield x 2, computing priority, from high to low (...), [...], {...} s [I], s [I: j] s. attribute s (...), function call + x,-x ,~ X ** y *,/, //, % +,-<, >>&^| <, <=, >,>= ,! = Is, not is in, not in not and or lambda

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.