Python basic syntax

Source: Internet
Author: User

Tag: Data type Execution store negation type dictionary operation using bitwise negation

The 1.python language is case-sensitive, Python is compared to C or C + + high-level languages, there is no {}, it is indented to represent blocks of code, and there are more data-type complex numbers than C and C + +, whose real and imag parts are float types; for null type values (either complex 0.0 +0.0j or empty tuple (), empty Dictionary {}) whose return value is false, as well as the user-defined null type;

2. For arithmetic operations in Python, * * denotes power,//Represents the integer portion of the division fetch, does not support ++,--operation;

3. For the logical operation in Python:

Boolean "and", if X is False,x and Y returns false, otherwise the value of Y is returned, eg:a=20 b=10 c=a and b c=10;

Boolean "or", if X is True,x and y returns True, otherwise the value of x is returned, eg:a=20 b=10 c=a or b c=20;

The continue statement in 4.python is used to end the loop, followed by the next loop, while the Else statement can be used with the while statement in addition to the if matching;

5. Positive anti-code, complement, the original code is the same, negative complement = anti-code +1, anti-code to keep the sign bit unchanged, the rest of the reverse; bitwise negation in Python, the value (complement) stored in the computer is reversed by a bitwise negation.

Python basic syntax

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.