Python Phase Summary

Source: Internet
Author: User
Tags python list jupyter notebook

---restore content starts---

Python Phase summary python installation:

First we need to install Python software, the teacher sent an installation package directly click to download the installation, according to the number of computer-based choice to download 64-bit. After the installation is successful, choose Anaconda3 (64-bit) from "Start" to select Jupyter notebook The following screen appears, waiting will jump to the Web interface, it can be used.

Python basic Syntax:

Identifier: consists of letters, numbers, and underscores, including English, numerals, and underscores (__), but cannot begin with a number. Identifiers that begin with an underscore are of special significance. Start with a single underscore the _foo class property, which is not directly accessible, is accessed through the interface provided by the class and cannot be imported with the FROM XXX import *; __foo, which begins with a double underscore, represents the private member of the class A __foo__ that begins with a double underscore and ends in a special method specific to Python, such as __init__ (), represents the constructor of a class.

The following is attached to some of the machine operation example diagram:

Introduction part: Object-oriented: definition and invocation of class

Classes are templates of objects that encapsulate the nature and behavior of the corresponding real entities

Practical results:

Custom Object sorting:

The sort method of the Python list type and the built-in sort function sorted (): Because of the extensibility of Python, each data type can be defined as a special method def__lt__ (Self,y) returns true as "small" than Y, which is ranked before, and returns false as greater than " , any custom class that is queued can use x<y such a comparison, as long as the class defines a special method __lt__

Example:

Inheritance mechanism for classes: code reuse

If two classes have a "general-special" logical relationship, then special classes can be defined as "subclasses" of the generic class, inheriting properties and methods from the "Parent class"

The subclass object can call the parent class method unless the method is redefined in the subclass (overwrite override)

Example:

Phase Summary:

Python is an object-oriented, literal translation of computer programming language, but also a powerful and perfect general-purpose language.

---restore content ends---

Python Phase Summary

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.