Python Foundation 2nd day-arithmetic operators

Source: Internet
Author: User
Tags arithmetic arithmetic operators

    • Arithmetic operators
1A=5;2b=2;3 Print(A+B);#result:7 desc: plus4 Print(A-B);#result:3 desc: minus5 Print(A*B);#result:10 desc: Multiply6 Print(B**10);#result:1024 desc: Power7 Print(A/b);#result:2.5 desc: except8 Print(a//b);#result:2 desc: Divide Evenly9 Print(A%B);#result:1 desc: Take surplusTen  One Print( notTrue);#false desc: Corresponds to Java! A Print(True andFalse);#false desc: Corresponds to && in Java - Print(TrueorFalse);#true desc: corresponds to Java | |
    • Take the maximum value in 3 numbers
1Num_1 =int (input ());2Num_2 =int (input ());3Num_3 =int (input ());4Max_num =0;5 ifNum_1 >num_2:6Max_num =num_1;7 Else:8Max_num =num_2;9 ifMax_num <Num_3:TenMax_num =Num_3 One Print(Max_num);

Python Foundation 2nd day-arithmetic operators

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.