Introduction to Python
This is an initial study of the Python language. Today it's the most widely used language in the market. It's usually the entry point for those seeking their first programming language. It's the most used by DevOps professionals.
- Interpreted language with simple and easy-to-understand commands
- Unlike a compiled language that needs to go through a compilation process, Python is a scripted (interpreted) language, meaning code compilation happens at runtime.
- Released in the early 1990s.
- In 2001, with the language already having a strong community, they created the Python Software Foundation (PSF), which is one of the maintainers and coordinators of Python. It's a non-profit foundation supported by various groups like Microsoft, Google, etc.
- It comes pre-installed on many operating systems (all Linux distributions, Mac, etc.), except Windows.
- Many computing and Internet of Things projects use Python as their standard language. For example, Raspberry Pi has as one of its purposes to be an environment for learning the Python language.
Why Learn Python?​
- It's a general-purpose language.
- Simple, easy, intuitive, and organized.
- Multi-platform.
- Object-oriented.
- Batteries included (most features are built-in).
- Open source permissive license.
- Many available libraries.
- Very active community.
Zen of Python
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
Installing Python​
The chances of it already being installed are very high. Basically, Python is an interpreter of code into machine language.
If you're on Windows, download and install Python from https://www.Python.org/downloads/. On other operating systems, it comes pre-installed.
Update Python
# Debian-based
sudo apt install Python
# Red Hat-based
sudo yum install Python
# Arch-based
sudo pacman -S Python
To check the version
python --version
How to Study?​
Don't forget to follow along with the official documentation.
- Studying is not enough if you don't practice. Watching someone play piano doesn't mean you'll play just by watching.
- If you copy and paste the examples, you'll be a great copier, not a programmer, and you'll never have new ideas.