Python Beginner Third Day

Source: Internet
Author: User

3day

Python basic syntax

1, Operator: arithmetic operator, comparison operator, assignment operator, logical operator

A, arithmetic operator: a=10,b=3

+ Plus A+b

-Minus A-B

* by A*b

/except A/b

% modulus a%b (take remainder)

Take an integer a//b (the integer part of the fetch)

* * Power a**b (b-th)

B, comparison operator: a=10,b=3

= = equals

! = does not equal

<> Not equal to

< less than

> Greater than

<= less than or equal to

>= greater than or equal to

C, assignment operator: a=10,b=3,c=10

= equals to assigning the value of a to D

+ = plus equals equivalent to C=c+a

-= minus equals equivalent to C=c-a

*= equals equivalent to C=c*a

/= equals equivalent to C=C/A

%= modulo equals c=c%a

= rounding equals equivalent to c=c//a

A power of **= equals to the equivalent of C=c**a

D, logical operator: a=10,b=3,c=10

And and

Returns true only if the condition is satisfied, and returns False if one of the conditions is not satisfied

OR OR

Returns False if none of the conditions are satisfied, or true if one of the conditions is satisfied

Not non-

Force the returned result to TRUE or false

2. Process Control:

Single Branch

Dual Branch

Multi-Branch

3. While loop

4. Dead Cycle

5. Break and Continue

Break jumps out of the current loop and no longer executes

Continue terminates this cycle and continues the next cycle

6, optimize the game of guessing age

Python Beginner Third Day

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.