First Program in Python

Table of Contents

So, writing a program is far easier compared to any programming language.

In this tutorial, we will look after the various ways of writing a Python program .

Using an Interactive interpreter prompt

For that, open your Command Prompt and type python and then press enter.

Now, write a simple print statement.

Using a Script file

For that, you have to create a text document at any location in your PC and write the simple print statement into it.

Now save it with any name but you just need to add the extension of the file as .py .

In this example it is

Now open the Command Prompt and change the directory to the location of the file you have created. In this example, the location of the Python file is desktop.

Using an IDE

For this ,you need a IDE where you can easily manage your Python files.

In this tutorial, we will use the PyCharm Community version for Python Programs for execution.

First of all, you have to create a project with any name of yours. This Project is nothing but just a managed folder where all of the Python files will be kept.

Notice that, we have selected the Existing Interpreter which is the Python execution file that we have installed and we have just mentioned the location of the execution file, such that the software PyCharm can locate it easily.

Now write the code inside it ,select it and try to run it.

Here you can notice at the bottom of the image where you can see the result of your program.

Previous Python Installation

Leave a Reply