Industries we support
Our "Smart Solutions" that can drive your business swiftly. Being resilient is our character throughout.
In this era of diversity in the latest technology, the ability to learn and be equipped in languages is the most challenging and interesting thing for a developer or a geek you can say. Me being a .NET developer, I found it interesting personally to get started with Python, an open source programming language using the Microsoft IDE, the latest one, i.e., Visual Studio Code. There are many reasons to choose & learn Python as my choice out of the box now since Machine Learning is the newest! Python is the best programming language and lightweight to use. I again say it is my personal choice to choose Python. Enough talk, let’s get started with what Python actually is and some facts about Python.
It’s an interpreted language which obviously follows object-oriented principles. Now, a lot of technical terms are being used. As of now, I know C# (Programming Language) is interpreted into bytecode and then is compiled by the Common Language Runtime whereas Python is a completely interpreted language, which means it is executed directly at the runtime unlike the compiled language, which first gets compiled into the assembly language which any CPU can understand. Python is considered as one of the best Rapid Application Development programming languages. It is easy so far for me to learn Python though it is just the beginning. Its semantics are diversified, that is, it makes easy as well as strict for the developers to follow the coding convention. The indentation is a part of its syntax and the semantics are modular which makes it rather more convenient for the developers to maintain the code.
Here, I would be sharing the process to set up Python on Windows. First of all, check if Python is pre-installed on your system. To check that, open Command Prompt and type python. If the output is not desirable i.e. ‘python’ is not recognized, then it is not installed to that path.
To download and install Python, click on the below link and download: Download Python for windows. Now, once downloaded, install the Python file with .msi extension in a path and navigate to the same path in command prompt and type python there. This output would show Python with the version installed and we are ready to write our first Hello World program and follow the tradition.
But before that, one of the important things to be done is setting up the environment variables or the system path. This is mainly required in UNIX and Windows because the OS searches for the executable in the specified path in the environment variables set. In Macintosh, the path is handled by the installer. Thus, the below images would guide to set the variables.
Now, we are all set for Python to run on Windows Command Prompt with the first “Hello World” program.
To develop applications using Python, we would surely need Python IDE. There would be many in the market, but yes, after being obsessed with the Microsoft products, I prefer to use the open source IDE by Microsoft, Visual Studio Code.
To start with after setting up Python on Windows, we need to install the Python extension for Visual Studio Code. Once the extension of Python for the Visual Studio code is installed, open Visual Studio Code and go to Files->Preferences->Settings. Once navigated, the User Settings window pops up. Once you see this window,
Search for the “python.pythonPath”. There would be Default Settings for the variable, now change the path to the installed folder path on your system.
Path is changed under User Settings too.
Now, we are all set to run any application on the Visual Studio Code in Python. In the IDE terminal below, type python; the output is as below.
When we navigate to the Extensions, we can see Python is enabled, with the Linking, Debugging extension. These are used for IntelliSense, the reason I love Visual Studio. Also, there are a few modules/packages which are kind of third-party but can be used as these are all open source. Just like in .NET, we have Nuget Package Manager. So in the terminal itself of the IDE, we can install any modules of Python like with the below command.
The above was one of the examples. The detailed discussion is out of this article’s scope. We will discuss in upcoming articles of this series. Now, let’s go ahead without wasting much time. Create a small program in Python and execute that to see the output.
This is a simple program where we have a class named Car with a method as Start that prints “started”. We will learn more about the properties and constructor in the next article. Maruti is the object instantiated and then the method start() is invoked through it. Thus, debugging this will give the output “started”.
Next, we will discuss the details and basics of Python in the upcoming articles of this series.
Next Recommended ArticlePython Functions Overview
In this article I will explain you how to create and call functions in python.