Theoretical Basis of Day1-python, path to python day1

Source: Internet
Author: User

Theoretical Basis of Day1-python, path to python day1
1. Introduction to pythonThe founder of Python is Guido van rosum. Guido was invented in 1989 to pass the fun of Christmas. It was designed by the National Institute of mathematics and computer science in the Netherlands (as an inheritance of the ABC language) and named Python, he is a fan of Monty Python's comedy community. The first public release of Python was released on August 1, 1991. Currently, there are almost 600 + programming languages around the world, but there are also 20 popular programming languages. If you have heard of tibench rankings, you will be able to know the general popularity of programming languages. It is the top 20 programming language rankings released in 2017. It is obvious that python has been increasingly recognized by developers.

Among the top five languages in the ranking, C, C ++, and C # are both compiled languages, while python and java are both interpreted languages. So what is a compiled language, what is interpreted language?

Compile-type language: before the program is executed, a special compilation process is required to compile the program into a file of the machine language. You do not need to re-translate the program during runtime, so you can directly use the compilation result.

The advantage is that you only need to compile the program once and do not need to compile the program during runtime. Therefore, the program execution efficiency is high, the disadvantage is relatively obvious, and the cross-platform performance is poor. Different execution files must be generated for different platforms.

Interpreted language: the program does not need to be compiled. The program is translated into a machine language at runtime. Each execution must be translated once.

The advantage is that it has good platform compatibility. You can directly run it after you directly modify the code and then quickly deploy the code. The disadvantage is that each operation requires compilation, compared with compiled languages, the performance is naturally worse.

 Ii. Advantages and Disadvantages of python

Advantages of python:

1. Simplicity: Python is a language that represents the simple ideology. Reading a good Python program is like reading English. It enables you to focus on solving problems rather than understanding the language itself.
2. Easy to learn: Python is extremely easy to use, because Python has extremely simple instructions.
3. High Speed: Python is written in C language at the underlying layer. Many standard and third-party libraries are also written in C, and the running speed is very fast.
4. Free and Open Source: Python is one of FLOSS (Free/open source software. Users can freely publish copies of the software, read its source code, make changes to it, and use part of it in new free software. FLOSS is based on the concept of a group sharing knowledge.
5. High-level Language: when writing a program in Python, you do not need to consider the underlying details such as how to manage the memory used by your program.
6. Portability: because of its open source nature, Python has been transplanted on many platforms (changed to enable it to work on different platforms ).
7. Interpretation: a program written in a compiled language such as C or C ++ can be written from the source file (C or C ++) convert to a language used by your computer (binary code, namely, 0 and 1 ). This process is completed by the compiler and different tags and options.
8. Object-oriented: Python supports both process-oriented and object-oriented programming.
9. Scalability: If you need a piece of key code to run faster or want some algorithms not to be made public, you can write some programs in C or C ++ and then use them in Python programs.
10. embeddable: You can embed Python into C/C ++ programs to provide script functions to program users.
11. Standard Code: Python adopts forced indentation to make the code readable. Programs Written in Python do not need to be compiled into binary code.

Disadvantages of python:

1. Single-line statements and command line output problems: in many cases, you cannot write a program into one line, for example, import sys; for I in sys. path: print I. Perl and awk do not have this restriction, so it is easier to complete simple programs in shell. Like Python, programs must be written into a. py file.
2. slow running: Compared with C and C ++.
3. The Code cannot be encrypted.

3. python2.7 or python3.x

  In fact, for python version selection, we have been using python2.7 since we used to work with python2.7 in the past. Select 3. there are several main reasons for this. First, the 2.7 version will stop updating the service on January 1, 2020. x compatibility, encoding, and other reasons.

4. Install pythonInstall python in windows

Download the installation package:

      https://www.python.org/downloads/

 

Installation:

Default installation path:

      C:\PYTHON35

 

Configure environment variables:

1. Right-click the computer;
2. attributes;
3. Advanced System settings;
4. Advanced;
5. Environment variables;
6. Double-click Path in the second box;
7. append the python installation directory to the value and separate it.


5. Hello World!

Create a hello. py file and enter:

    print("Hello World")

Run the following command in the command line:

    python hello.py

You can see the system return:

E: \> python hello. py
Hello World!

Vi. Variables

1. Functions of variables:

Variable

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.