Python is a very popular programming language that is both interactive and intuitive from an individual’s perspective. It was created by Guido Van Rossum and became public in 1991. Python’s success is mirrored in its open-source origins and the vast variety of applications where it can be applied.
Python is an all-level language and does not require any specific prerequisite to learn unlike C++ and C# which require a basic understanding of the framework of C. Python is an object-oriented programming language, utilizing all 4 concepts of OOP namely: Abstraction, Encapsulation, Inheritance, and Polymorphism.
Python is a dynamic and GNU-approved programming language and similarly to JAVA, it has a garbage collector. Python can be used in a procedural or OOP-based manner and as mentioned earlier, it allows for flexibility and is extremely dynamic.
Python executes and interprets commands at runtime and does not utilize the compiler in a manner similar to other languages, it uses an interpreter that allows for quick and reliant prototyping and testing. Python has an extremely simple syntax, removing the need for parenthesis and terminators but instead, it uses white spaces to determine stops and breakages.
Where Can it be Used?
Python has a wide array of applications where it can be used, such as data analysis, data scraping, API development, minor web applications, database control, machine learning, artificial intelligence, and big data along with complex mathematics. The applications of python allow it to be utilized around the world in major big-name organizations and projects making room for jobs and work opportunities for python developers.
Since Python has a relatively simple syntax similar to the English language, it opens up the scope for interns and freshies that are new to the new language. It is not a hard language to learn and shares a lot of functions with the majority of languages allowing a complete scope of knowledge to the learner.
Getting Started with Python
There are various options that you can start with to get a basic understanding of python and make your first hello world project come to life, to learn how you can do so, follow this guide:
1. Downloading Python Interpreter
In order to set-up your machine to support python and its prerequisites, you need to install it first, head over to the official python website and install the latest python file labeled as 3.11.
Once you have downloaded the python file, run it and an installation wizard will open up, follow through the installation guide and complete the installation.
Note: Once you reach the prerequisites of python in the installer, the PATH checkbox is unchecked by default, if you don’t have a python environment variable already set on your computer, you might need to check that box to allow the installer to automatically set the PATH variables for python’s environment.
For macOS
Follow the same aforementioned guide for installation on macOS, all you have to do is to head over to Python for macOS page and install the latest 3.11.0 file from there instead of the default installation page. You won’t be asked to set environment variables on macOS as the entire process is automated.
Using Anaconda
Please note that if you are installing python with Anaconda, you don’t need to follow the aforementioned process, just start from here. Go to the official anaconda website and download the installer for the latest python version which is 3.9 for Anaconda. Follow through the installation wizard, once you reach the PATH variable section, you can choose to tick or untick the PATH variable checkbox, and leave it unchecked if you are unsure whether you already have a python PATH set or not. You can do it later on.
Follow the same process for macOS with the exception that MacOS does not require you to choose the PATH variable, it does so automatically.
2. Selecting an IDE or Code Editor
IDE stands (Integrated Development Environment), each programming language has a different IDE that is suited for its development and there are some with multiple languages and compiler/interpreter support. Some of the most popular IDEs for python are as follows:
Anaconda (Jupyter, Spyder & PyCharm): Anaconda is a complete package for python development and includes three different IDEs for python and R programming. Spyder and PyCharm are most recommended as they are intuitive and easy to use.
- VsCode: Head over to the official VsCode site and simply click on download, if you are on macOS, click on the drop-down menu beside the download button and select macOS. Once downloaded, run the installation app and it will install VScode on your machine relatively by itself.
- Once you have an open window of VsCode, simply navigate to the left-hand sidebar and click on the extensions icon/tab, once open, search ‘python’ in the search bar and click on the little blue install button beside the search result.
Once clicked, it will automatically set up the python development environment within VsCode. You can now simply create a new project with a new .py file and start your python development from there.
The First ‘Hello World‘
Open up your VsCode and follow the guide:
Create a directory manually or use the mkdir "your project name"
command in the command terminal and import the folder into your VsCode.
Once done, click on the new file icon file and save it with the .py extension.
Write the following code in your file
M1 = "Hello world"
Print(M1)
Before execution, you need to select an interpreter, click ctrl+shift+P in VsCode and enter the following >Python: Select Interpreter
Once you run this command, you will be presented will multiple options of an interpreter, select the latest one and if you installed Python using anaconda, you might see Python "version" ('base')
Conda, if so, select that one, otherwise just use the first option.
Once you have followed through the process, you can now click on the run command and the application will provide feedback of ‘Hello World’ printed on your debugger, it’s just that easy!