Getting Started

Table of Contents

Python Set up

  • Most operating systems other than Windows already have Python installed by default.
  • To install Python on Windows, go to the download page and download Python. Run the Python installer and accept all the defaults.
  • When Python is installed, you can open Interpreter console and write your 1st “Hello World” program.
>>> print("Hello World!")
Hello World!
  • You can use any text editor to write your python program/script. Then save it with .py extension.
  • You can run your python program/script by typing python and the file name with .py extension on your terminal.

More on intalling python can be found here -  Install Python


Interactive Prompt

  • The interactive prompt runs code and echoes results as you go, but it doesn’t save your code in a file.
  • It turns out to be a great place to both experiment with the language and test program files on the fly.
  • The Python interpreter is usually installed as /usr/local/bin/python3.7 on those machines where it is available; putting /usr/local/bin in your Unix shell’s search path makes it possible to start it by typing the command:python3.7 to the shell.

  • Since the choice of the directory where the interpreter lives is an installation option, other places are possible; check with your local Python guru or system administrator. (E.g., /usr/local/python is a popular alternative location.)

  • On Windows machines, the Python installation is usually placed in C:\Python37, though you can change this when you’re running the installer. To add this directory to your path, you can type the following command into the command prompt in a DOS box:

set path=%path%;C:\python37


  • Open the command prompt (bash console in linux) and type python . It will show the prompt as follows with a welcome message
$ python3.7
Python 3.7 (default, Sep 16 2015, 09:25:04)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
  • You write code after >>> and press the Enter key to get the output.
>>> print("Hello World!")
Hello World!
>>> 2+6

More on interactive mode will be find here -


Write Your First Python Program in Script mode

Open your favorite text editor (e.g., vi, Notepad, or the IDLE editor),type the following statements into a new text file named, and save it in your working code directory. .

print(“Hello User!”)


Running your program with Command Line

Once You have saved the file you can run it with command window. Move to the directory in which you have saved the script. Then type python command and then the file name with .py extension to execute the scripts. You will get the following result.

C:\code> python
Hello User!


Comments in Python

A comment starts with a hash character (#) and ends at the end of the physical line.

In the below code, print('Hello user')  is commented. So when you run the it will not print "Hello user". Check the output

print('Hello World')
# print('Hello user')
Hello World



The indentation rule may seem unusual at first glance to programmers accustomed to C-like languages, but it is a deliberate feature of Python, and it’s one of the main ways that Python almost forces programmers to produce uniform, regular, and readability.

if x:
    if y:

Nested statements are blocked and associated by their physical indentation(without braces).

More on indentaion can be found here

Click any Link
to navigate to certain page easily
Write a line to us
Your Email