Skip to content

Introduction to Python

Pythons are very powerful and very flexible creatures, as we all know. In the same way, we find that the language Python is also very powerful and flexible.

Python is an open source, object-oriented, high level programming language which was developed by Guido van Rossum in 1991.

The language is based on the ABC language(yes that is a language, and no, i am not referring to English), which is a language made for teaching, and to replace the now outdated BASIC language.

Before we actually get into the commands, and the features of IDLE and script mode, we first need to know the general features of the language:

  • Python is interactive, interpreted, directly executed, with pre-compiled code. What this essentially means is that if you write a program, it will get executed line-by-line, and in the case of an error, the program will either exit(in case of a runtime error), or will raise an error before the program is run(in the case of a syntax error). more about the difference between compiled and interpreted languages an be found here.
  • It is object-oriented, with simple English-like structure.
  • This language makes programs several times shorter than Java programs.
  • It supports GUI (graphic user interface) and Garbage collection (memory management).
  • It is compatible with other popular languages like C, C++, Core Java, etc.

The advantages of Python are:

  • It is Platform independent.
  • Easier to read.
  • Lesser learning time (which I intend to make sure you take full advantage of, heh heh)
  • GUI programming.
  • Plenty of libraries are available for ease of making programs. This shortens programs enormously.
  • Python highlights different tokens with different colours.

Now, I am assuming you are using Python 3.7, the method to download which can be found here.

Now, let us start with the actual topic (come on, the previous stuff was kind of boring, no?):


To interact with python, we can use one of two methods(both of which are a part of IDLE), the uses of which shall be explored here:

  1. Interactive mode
  2. Script mode

1.Command line interaction

In interactive mode, we find that there is a prompt >>>, in which we write the commands and then press enter to execute.

Let us write a simple program to print a sentence:



Another example:

>>>print(‘ hello ‘)


So, we see that to print commands in the interactive window, we can use either a string in quotes(can be single, double or triple) or we can use the print() command. Note that the quotation marks can be single double or triple. Python does not differentiate between single and double quotes, but the triple quotes have a special significance, but we shall get to that later. Python is a case sensitive language, and so print is not the same as Print.

More about Python shell:

  • the shell has many menus
  • these menus have the options: File, Edit, Shell, Debug, Options, Windows and Help.
  • Edit menu deals with text editing options(Undo ,Redo, etc.)
  • Options menu is to help you configure IDLE according to your preferences.
  • Help is for Python help and documentation.
  • you can press Alt+P to repeat a command in IDLE.
  • you can exit command prompt by clicking Ctrl+Z and pressing enter or by typing quit() or exit() and pressing enter.

2. Script Mode

In File menu, select the ‘New File’ option. This opens a new window, which has a few benefits over Shell mode, where the most important one is that it allows you to write long programs easily. This can be done as the enter command does not cause execution of the command entered. This text editor is be default named ‘Untitled’ (as you have not titled it, duh) and can be named by using the ‘Save As’ option in the File menu. We shall mainly work in the Script mode and you shall learn the various commands and methods for this mode as and when we come across them.

So, in the end you just need to know the following things:

  • Python has two interaction modes: Shell (Interactive) and script mode
  • Single and double quotes behave the same way in Python.
  • Python is case-sensitive.
  • It is easier to write programs of Python(the longer ones at least in Script Mode).
  • Python in script mode goes line-by-line in Script Mode as it is interpreted.

The rest was utter nonsense.

Next –

Print Command in Python

%d bloggers like this: