SaralGyaan, Saral Gyaan, Saral Gyan is website which provides free tutorials of Python for absolute beginners in English and Hindi, Learn Python in Hindi, Learn Python for absolute beginners, Learn Python, bootstrap, django, git

Hari S
Author: Hari S

Chapter 3 - Executing a Python Script

Chapter 3 - Executing a Python Script

  • Feb. 4, 2019, 12:12 p.m.
  • 2 minutes read
Chapter 3 - Executing a Python Script

In our previous chapter, we have strongly recommended you to ditch IDLE and use some code-editor and terminal(MacOS/Linux) or Powershell(Windows) to write and execute your python script. In this chapter we will tell you how to do that.

First and foremost for the purpose of this tutorial, create a new directory say ‘python_for_beginners’ at your desired location.

$ mkdir python_for_beginners

Now let’s create a new file in this folder and name it ‘’. Open that file in the editor you are using and write down the following code and save it:-

print("hello world!")

Now open your terminal and cd to the ‘python_for_beginners’ folder. Alternatively on MacOS you can right click on the folder and select ‘New Terminal at Folder’. To run the script you will have to write:-

$ python

and you will get the output like this:-

hello world!



Note- Some of the users probably on MacOS might need to use python3 instead of python to run the script in Python 3 version, though I will be using python in my tutorial, but I urge you to check you version and use python3 or python accordingly.

If you have any question till now, feel free to ask in the comment section.

Table of Contents

Chapter 2 - Quick Setup

Chapter 4 - Print function

Related Posts

Matplotlib Tutorial in Python | Chapter 2 | Extracting Data from CSVs and plotting Bar Charts.
By Hari S | 3 weeks, 5 days ago

Matplotlib Tutorial in Python

Chapter 2 | Extracting Data from CSVs and plotting Bar Charts

In the last chapter, we learned to draw simple plots in Matplotlib and further customizing it.In this chapter we will be learning to extract data from external sources like CSV and creating ...

Read More
Filling Area on Line Plots | Matplotlib Tutorial in Python | Chapter 5
By Hari S | 3 weeks, 4 days ago

Matplotlib Tutorial in Python

Filling Area on Line Plots | Chapter 5

Matplotlib Line plots are a good way to represent your data. But sometimes you need more than that to make your data self-explaining. In such a case, filling the area between or under a Maplotlib Line Plot ...

Read More
Chapter 5- Indentation
By Hari S | 7 months, 1 week ago

Like many other languages, python is also a block-structured language.


Block is basically a group of statements in a code script. A block in itself can have another block or blocks, hence making it a nested block. Now, to differentiate one block of code from another, we need ...

Read More