Writing Python Program

Generally. Two types of programming can be done using python :-

a) Interactive Program
b) Script file program

Interactive Program :-

As discussed, by typing #python in the command prompt, python interpreter will be started & opens up interactive mode as below,

>>> print "welcome"

NOTE :- If new version (3.x) is used then you need to use parentheses like print ("hello")

NOTE :- print is used to print the output

In Interactive mode, you will see the output as you type the line which displays the output

Script mode programming :-

In script programming, you need to write a program in a file and save it as .py file (lets say - and then run #python OR chmod +x ; ./ by adding #!/usr/bin/python in the first line of the file in the latter case. Please Click Here for more information on the same

Leave a Reply