Python Tutorial 1

Posted on Posted in Software

Python is a high-level, general-purpose, interpreted, dynamic programming language. It was created by Guido van Rossum during 1985- 1990. There are two versions of Python available: 2.7 and 3.3. This course will cover 2.7 Version. Of course, if you wish then you can download and use 3.3 Version.

Features of Python

  1. Clearly defined and readable since it uses English keywords, simple structure, and a clearly defined syntax (human-like language and NOT machine-level).
  2. Python is processed at the runtime by the Interpreter. There is no need to compile your python program before executing it.
  3. Python supports Object-Oriented technique of programming that encapsulates code within objects.
  4. Python can run on a wide variety of hardware platforms and has the same interface on all platforms.
  5. Python supports GUI applications that can be created and ported to many system calls, libraries and windows systems.
  6. It can be used as a scripting language or can be compiled to byte-code for building large applications.
  7. It supports automatic garbage collection.

It has numerous applications in areas such as web programming, scripting, scientific computing, image processing, Big Data and Artificial Intelligence.

So first we have to download and install python. I am demonstrating with the help of Windows.

Windows Installation

Go to https://www.python.org/ and download it based on your OS.

p1

Click the downloaded .msi file and follow the screenshots.

p2

p3

p4 p5

In this stage, you need to select Will be installed on local hard drive. This will set your path.

p6

p7

Once installed, the python console can be accessed using command line by invoking the Python interpreter directly or best way is running GUI that comes installed with Python called IDLE. If you need to check whether you have successfully installed it or not, then open IDLE, you will see a prompt of 3 right arrows. Type in print ‘hello world’, then hit enter. No need to write semicolon like you do in C or C++. You will see something like this:

If you don’t see this, then you have done wrong somewhere. Go to Control Panel> Programs> Uninstall Programs and uninstall python. Then if you keep your default drive C while installing, go there and delete Python27 file. Then start installing it again.

Linux Installation

  • After going to the website, follow the link to download zipped source code available for Unix/Linux.
  • Download and extract files.
  • Editing the Modules/Setup file if you want to customize some options.
  • run ./configure script
  • make
  • make install

This installs Python at standard location /usr/local/bin and its libraries at /usr/local/lib/pythonXX where XX is the version of Python.

Setup path in Linux:

  • In the csh shell− type setenv PATH “$PATH:/usr/local/bin/python” and press Enter.
  • In the bash shell (Linux)− type export PATH=”$PATH:/usr/local/bin/python” and press Enter.

Macintosh Installation

See http://www.python.org/download/mac/ for instructions on getting the current version along with extra tools to support development on the Mac. In Mac OS, the installer handles the path details.

So that’s it for today. I hope you have liked your first tutorial. See you in the next one. Peace. 🙂

Spread it!

3 thoughts on “Python Tutorial 1

    1. Hello, Reema. You can go to the Python website and there are docs available separately for Python 2.7 and 3. So it will give you a good start.
      Apart from that, you can google for best python ebook for beginners. However, I have found Learning with Python by Allen Downey, Je rey Elkner and Chris Meyers pretty good for beginners.
      Hope this helps. 🙂

Leave a Reply