Learn Python: Tutorial 1: History of Python, Using Interactive Mode, Creating Source Code Files and Running Them (16.04.13)

The History of Python (based on article published on wikipedia)

Python is a general-purpose, interpreted, object-oriented programming language.

Python was created by Guido van Rossum in the Netherlands in 1990 and was named after the popular British comedy troupe Monty Python’s Flying Circus. Van Rossum developed Python as a hobby, and Python has become a popular programming language widely used in industry and academia due to its simple, concise, and intuitive syntax and extensive library.

Python is a general-purpose programming language. That means you can use Python to write code for any programming task. Python is now used in the Google search engine, in mission-critical projects at NASA, and in transaction processing at the New York Stock Exchange.

Python is interpreted, which means that Python code is translated and executed by an inter-preter, one statement at a time.

Python is now being developed and maintained by a large team of volunteers and is avail-able for free from the Python Software Foundation. Two versions of Python are currently coexistent: Python 2 and Python 3. The programs written in Python 3 will not run in Python 2. Python 3 is a newer version, but it is not backward-compatible with Python 2. This means that if you write a program using the Python 2 syntax, it may not work with a Python 3 inter-preter.



Using Interactive Mode 
(QUADD BLOG ARTICLE ON USING PYTHON INTERACTIVE MODE)

Creating Python Source Code Files

Using Python in Interactive is simple and convenient, but to make large programs and to save them, like any other programming language, source code files are need to be saved. In Python, its very simple to create source file with extension (.py) using any plain text editor. In following example we have used 'gedit' text editor, and 'terminal' running on Ubuntu (Linux) to run Python program in command line interface.

Source Code file: '01_messages.py' is typed using 'gedit' and saved with extension .py in the folder where Python is installed, in this example it is stored in 'Home' folder of user.

Running Program in 'Terminal' in command line interface.Syntax to run programs in CLI: python <python source code filename>

This program (source code) can also run using GUI tool of Python called IDLE.
In IDLE, press Ctrl+O (Open) and select source code file, in this example name of source code file is '01_messages.py'

A separate window will open displaying contents of Python source code file. Press F5 to run the code.

The Output of the file is shown in the main window of python shell.
Description of the Program used in this tutorial.
#Print Two Messages (This is a comment)

Print ("Say Hello to Python") (This is output statement in program which will print message on the screen - Say Hello to Python)

Print ("Python is your friend") (This is output statement in program which will print message on the screen - Python is your friend)

--End of Tutorial One--
LINK TO TUTORIAL 2

1 comment:

  1. Hi, thanks for your blog, if you want to learn about programming languages like java, php, android app, embedded system etc. I think this training institute is the best one.
    best python training in coimbatore
    Android training in coimbatore
    Networking training in coimbatore

    ReplyDelete