There are hundreds of coding languages today, with more being written every day. And between them, Python takes a step up to stand out. Python is easy to use, powerful, versatile, and with a big community giving maintenance and expanding it, making it a great choice for everybody to learn.
According to the Stack Overflow Trends, which measure the count of tags in posts on the platform, Python is becoming more popular year by year.
Python has a simple syntax, comparing it with the vast majority of other languages, you will need less lines to code the same algorithms. That, in my opinion, makes it the most simple one to use in the coding interviews, as you can write your code in fewer minutes, and spot a typo faster. And it is not a surprise that Google, Facebook, Instagram, Spotify... and so much more companies are using it. A shorter code means that is easier to give maintenance to it.
It has a lot of libraries, so you can do a lot of things with Python. You can download free libraries for almost any topic you want from the official third-party software repository, Pypi. Python also has its own powerful framework for Web development, Django, that encourages rapid development and clean, pragmatic design.
Let's talk about its most important disadvantage, it is slow, like between 2 to 20 times slower than other languages to do the same task. The main reason of that, is that it’s dynamically typed, you don’t need to specify data types or its sizes like in other languages. This means that a lot of memory needs to be used, because the program needs to reserve enough space for each variable to make it works in any case. And lots of memory usage translates to lots of computing time.
But nowadays, for most of the daily life applications, the speed issues do not matter so much. Computers and servers have gotten so advanced and cheap that we’re talking about fractions of seconds. You won't really care whether the app loads in 0.001 or 0.02 seconds.
But hold your horse, Python is not always the best solution. If the "real-time" really matters in the application, such as control implementations (drones, stabilizers), management of a huge amount of data (Google Hash Code, Facebook Hacker Cup, PhD researches), dealing with big time-cost libraries (NLP, computer vision) or any other advanced topic, probably you will need to swap to C, or C++.
You need to go to the oficial page of Python and download the current installator, or an older version you are looking for.
If you are in Windows, I would recommend you to install Python directly in the main folder to have an easy path to it, C:\Python## (where ## is the version you install). Take care with the options you click, you should select the options "pip" and "Add Python to environment variables", otherwise you will have some problems along the use of Python.
First, you need to know if it is already declared, so go to your terminal and type "python --version" and "pip --version", that will display the current versions you have already installed. In case the variables are not declared, it will display an error.
To write the environment variables, go to:
Control Panel > System and Security > System > Advanced system Settings > Environment Variables
Then, you will need to edit the variable "Path" in the 2 sections. Then, you will need to add the paths "C:\Python##" and "C:\Python##\Scripts",
in case you took my advice, otherwise search for your Python and Scripts paths, and add them to the "Path" variable.
The order of the variables affects the behavior in the terminal, the first python path will be set, and the following ones will be ignored. In case you have multiple versions of Python installed.
If you have Python in the environment variables, you can run Python directly in the terminal with just typing "python".
If you want to run a program for the terminal, you need to write in the terminal "python <file-path>".
You can run and debug Python files in VSC, but you will need to install some extensions to have a better experience.
Extension | Description |
---|---|
Python | A Visual Studio Code extension with rich support for the Python language (for all actively supported versions of the language: >=3.6), including features such as IntelliSense, linting, debugging, code navigation, code formatting, Jupyter notebook support, refactoring, variable explorer, test explorer, and more! |
Pylance | Pylance is an extension that works alongside Python in Visual Studio Code to provide performant language support. Under the hood, Pylance is powered by Pyright, Microsoft's static type checking tool. Using Pyright, Pylance has the ability to supercharge your Python IntelliSense experience with rich type information, helping you write better code faster. |
There are some companies or projects that has a certain Python version and they haven't updated yet, then you will need to swap to that version to run the code. I usually swap between Python 3.7, Python 2.7 and Pypy 3.7, because I have all the libraries installed in Python 3.7, Pypy 3.7 gives me better times to run my codes, and I use Python 2.7 to debug some codes of platforms that only supports Python 2.7.
To swap between the Python versions, you need to go to the bottom-left of VSC and click on the current Python version you are using.
Then a small menu will show up in the middle of VSC, where you can select between the different Python versions you have already installed in your computer.
"pip" is a package manager for Python packages. It will help you to install libraries, to check out all the free libraries you can download and use in Python check the official PyPI web page.
When "pip" is installed correctly, it is added to the system as a command line program which can be run from the terminal. The command pip is not only used to install and uninstall Python packages/libraries, it is rather a great tool to create Python virtual environment. Here are the most used ones:
Command | Description |
---|---|
search | "pip search <package>" will search for the package in Pypi. I will return the name and description of all the matching packages. |
install | "pip install <package>" will install the current version of the package. |
uninstall | "pip uninstall <package>" will unistall the package form your computer. |
show | "pip show <package>" will give you details about a package that is currently installed. |
list | "pip list" will return the name of all the packages that are installed in your computer. |
By time to time you will need to update the "pip" command, to do that you only need to type the following line in the terminal:
python -m pip install --upgrade pip