Starting with Python
Bài đăng này đã không được cập nhật trong 6 năm
Overview
Python is a high-level, interpreted, interactive and object-oriented scripting language. Python is designed to be highly readable. It uses English keywords frequently where as other languages use punctuation, and it has fewer syntactical constructions than other languages.
Python is Interpreted − processed at runtime by the interpreter. You do not need to compile your program before executing it. This is similar to PERL and PHP.
Python is Interactive − We can actually sit at a Python prompt and interact with the interpreter directly to write your programs.
Python is Object-Oriented − supports Object-Oriented style or technique of programming that encapsulates code within objects.
Python is a Beginner's Language − a great language for the beginner-level programmers and supports the development of a wide range of applications from simple text processing to WWW browsers to games.
It is used for:
- web development (server-side)
- software development
- mathematics
- system scripting
Advantages
Python is an object-oriented programming language that interprets and allocates dynamic memory. The main advantages are the developers ahead of time such as:
- Cycle editing, fast bug checking, debugging easily with a debugger written in python itself.
- Simple syntax, easy to learn, easy to read, clear structure, helps to reduce maintenance costs. Code is also short for programming quickly and efficiently.
- Highly reliable with lots of modules, support library for each job, especially for large data processing, which helps to build Recommend System systems with Deep Learning - a hot phrase currently.
- Easy to combine with other programming languages such as C, C ++, Java ...
- And there are many advantages that I can not list out all.
Application
Python is used for many purposes such as:
- Game Programming: This one I found on the Internet mentioned but I'm not sure about this.
- Web Programming: Some popular websites based on python like: Youtube, Dropbox, Survey Monkey, Google, Quora, Yahoo Maps, Instagram ...
- Support build GUI applications: Sublime text, Blender, Ansible, Ubuntu ..
- Building Machine Learning systems with python:
- Tensorflow: Open library from Google Brain, offering multiple APIs for machine learning with artificial neon networks
- numpy: handle N-dimensional array objects
- pandas: Library for analyzing Python data, including structures such as data frames
- scikit-learn: Machine learning algorithms for data analysis and data mining
Install python and run the basic application
Setting
- On the window: We go to the official python download page for the window and download the corresponding installer (32 bits, 64 bits) and follow the instructions.
- On ubuntu: We can install via command line:
#python 2:
sudo apt-get install python
#python 3:
sudo apt-get install python3
# check python library
python #python2
python3 #python3
result:
Python 2.7.12
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
-----------------------
Python 3.5.2
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
Run the basic application
Let's write our first Python file, called hell_world.py
, which can be done in any text editor. For example, create a file named hell_world.py
Save to folder python-project
with the following content:
print 'Welcome! ...'
# print('Welcome! ...')
Run the command by typing command python hell_world.py
at the command line. So what will you see? Here's what you see:
Welcome! ...
Conclusion
This is the first article to note when learning about Python. I will try to write more about Python in the learning process as mentioned. In the next article, we will learn more about basic python operators. Use branching expressions, and loops in python to solve small workouts.
All rights reserved