python--operator

Source: Internet
Author: User

+ plus Plus-----------------------------------
- Minus minus-------------------------------
/slash Divisible----Quotient-------------------------(priority of multiplication is higher than plus minus)
* asterisk multiplication sign----------------------------
% percent Residual----remainder-----------------

• < Less-than less than
• > Greater-than greater than sign
• <= less-than-equal less than equals sign
• >= greater-than-equal greater than equals sign

The United States we use Pemdas this abbreviation to assist the memory, it means " bracket, exponent, multiply, divide, add, Subtract "--
Parentheses exponents Multiplication Division addition subtraction-- it 's also in Python.
The priority of the operation.

First look at an example:

1 #!/usr/bin/python2 #Coding:utf-83 4 Print "I'll study number"5 6 Print "Feifei", 20+30/6#expected to be7 Print "Juanjuan", 100-25*3%4#expected to be8 Print3+2+1-5+4%2-1/3%4#expected to be 19 Print3+2<5-7#expected to be falseTen Print5>-2#expected to be true One Print5>=-2#expected to be true A Print5<=-2#expected to be false

Results:

python--operator

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.