Common programming errors for Python

Source: Internet
Author: User

Common programming Error 2.1 attempting to access an unassigned variable results in a run-time error.

Common programming Errors 2.2 ==,!=, >= and <= the presence of spaces between the two symbols of these operators can cause syntax errors.

Common programming Errors 2.3!=,<>, >= and <=, if the order of two characters is reversed (write =!). , ><, =>,=<), which can cause syntax errors.

Common Programming Error 2.4 You must not confuse the equality operator "= =" with the assignment operator "=". In fact, according to the orthodox logic, when reading, equality and operators should be read as "... Equal to ... ". The assignment operator should read "... Get ... "," Get ... The value "or" is assigned to ... ". Some people prefer to read the equality operator as equals equals. In Python, if an incorrect assignment symbol is used in a conditional statement, a syntax error is created.

Common Programming Error 2.5 forget to insert a colon in the IF structure (:) make syntax errors.

Common programming error 2.6 forgetting to indent (indent) The body of the if structure to make syntax errors

Common Programming Error 2.7 If a region contains lines of code that are not indented uniformly, the Python interpreter considers those rows to be in other regions, resulting in grammatical or logical errors

Common programming errors for Python

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.