Python Basics | Module, pip & Comments in Python

Python is a general-purpose, object-oriented programming language with high-level programming capabilities. It has become famous because of its apparent and easily understandable syntax, portability, and easy to learn.

Python is a programming language that includes features of C and Java. It provides the style of writing an elegant code like C, and for object-oriented programming, it offers classes and objects like Java.

Let’s write our very first python program.

Create a file called and paste the below code into it

print(“Hello World”)         # print is a function (more later)

Execute this file (.py file) by typing python, and you will see Hello World printed on the screen.


A module is a file containing code written by somebody else (usually) which can be imported and used in our programs.


Pip is a package manager for python. You can use pip to install a module on your system.

E.g., pip install flask (It will install flask module in your system)

Types of modules

There are two types of modules in Python:

  1. Built-in modules – Pre-installed in Python
  2. External modules – Need to install using pip

Some examples of built-in modules are os, abc, etc.

Some examples of external modules are TensorFlow, flask, etc.

Using Python as a Calculator

We can use python as a calculator by typing “python” + TO DO on the terminal. [It opens REPL or read evaluation print loop]


Comments are used to write something which the programmer does not want to execute.

Comments can be used to mark the author’s name, date, etc.

Types of Comments:

There are two types of comments in python,

  1. Single line comments – Written using # (pound/hash symbol)
  2. Multi-line comments – Written using ‘’’ Comment ‘’’ or “”” Comment “””.

Excercise :

  1. Write a program to print Twinkle-Twinkle Little Star poem in python.
  2. Use REPL and print the table of 5 using it.
  3. Install an external module and use it to perform an operation of your interest.
  4. Write a python program to print the contents of a directory using os module. Search online for the function which does that.
  5. Label the program written in problem 4 with comments.

Was this article helpful?

Leave a Comment

Your email address will not be published. Required fields are marked *