程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Programming Mathematical Modeling with Python - Features, Advantages and Disadvantages of Python (Course 1)

編輯:Python

Using python to program mathematical modeling

Introduction to Python:

Python is a computer programming language.At present, there are many programming languages, such as C language, which is difficult to learn, Java language, which is very popular, and JavaScript scripting language suitable for web programming.So, how to locate the Python language? To develop programs in any programming language is to let the computer complete certain tasks, such as uploading or downloading files, writing a document, etc., and the computer's CPU is only responsible for recognizing machine instructions, so, although differentThe programming languages ​​are very different, and they must be translated into machine instructions that the CPU can execute.And different programming languages, even to do the same job, the amount of code written is also very different.
For example, to complete the same task, it takes 1000 lines of code to write in C, 100 lines in Java, and maybe 20 lines in Python.Therefore, Python is a fairly concise high-level language.
For beginners, the Python language is very simple and easy to use, and many large companies, including Google, are using Python on a large
scale.
There are many everyday tasks that can be done with Python.For example, you can make websites, many famous websites including YouTube are developed in Python; you can do the backend of online games, and the backends of many online games are developed in Python.Of course, the Python language also has inapplicable fields, such as developing operating systems, mobile applications, 3D games, etc.

Features of Python

(1) Easy to learn.Python has relatively few keywords, simple structure, well-defined syntax, and easy to learn.
(2) Easy to read.Python code is clearly defined.
(3) Easy to maintain.A big reason for Python's success is that its source code is fairly easy to maintain.
(4) has an extensive standard library.One of the biggest advantages of Python is that it has a rich library and can be used across platforms, with good compatibility in different systems such as UNIX, Windows and Macintosh.
( 5) Support interactive mode.Interactive mode allows the user to enter and execute code from the terminal and obtain results.The interactive mode allows users to test and debug code.
(6) Portable and strong.Based on its open source nature, Python has been ported (that is, made to work) to many platforms.
(7) Strong scalability.If the user needs a critical piece of code that runs very fast, or wants to write some algorithms that are unwilling to be open, he can use C or C++ to complete that part of the program, and then call them in the Python program.
(8) Support database.Python provides interfaces to all major commercial databases.
(9) Support GUI programming.GUI programming code under Python can be created and ported to many system calls.
(10) can be embedded.Users can embed Python code into C/C++ programs, allowing program users to gain "scripting" capabilities.

The advantages of the Python language

(1) Provides a rich basic code base.When starting software development in a language, in addition to writing core code, you also need a lot of basic ready-made code that has been written to help speed up the development progress.Python provides us with a very complete basic code base, covering a large number of programming contents such as network, file, GUI, database, text, etc., which is vividly called "Batteries Included".Developed in Python, many functions do not have to be written from scratch, and can be directly used off-the-shelf.
(2) There are abundant third-party libraries.In addition to the built-in libraries, Python also has a large number of third-party libraries, that is, libraries developed by others that can be used directly by users.Of course, if the code you develop is well packaged, it can also be used by others as a third-party library.
(3) Wide range of applications.Many large websites are developed with Python, such as YouTube, Douban, etc. in China.Many large companies, including Google, Yahoo, etc., and even NASA (NASA) use Python heavily.

Disadvantages of the Python language

Any programming language has shortcomings, and Python is no exception.
(1) The running speed is slow.Compared with C programs, Python runs very slowly, because Python is an interpreted language, and the code is translated line by line into machine code that the CPU can understand when it is executed. This translation process is very time-consuming, so it is very slow.The C program is compiled directly into machine code that the CPU can execute before running, so it runs very fast.But a lot of applications don't need to run so fast because the user doesn't feel it at all.For example, to develop a network application for downloading MP3, if the running time of the C program takes 0.001 seconds, the running time of the Python program takes 0.1 seconds, but because the network is slower, the user still needs to wait 1 second, and the user basically does not feel 1.001 seconds.The difference between seconds and 1.1 seconds.
(2) The code cannot be encrypted.If you want to publish a Python program, you are actually publishing the source code.This is different from the C language.The C language does not need to release the source code, only the compiled machine code (that is, the common xxx.exe file on Windows.) is released.It is impossible to deduce C code from machine code. Therefore, all compiled languages ​​do not have this problem, and interpreted languages ​​must release the source code.


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved