Getting started with Python

Reading time ~1 minute

A short tutorial on setting up a PC/Mac/Linux machine to program in python.

0. Prerequisites

0.0 Python 2.7

Windows :

Go to

https://www.python.org/download

and click on the link that looks like

Python 2.7 Windows Installer (Windows binary – does not include source)

When the download completes install python by following the instructions on the screen.

Now open a terminal and type

set path=%path%;C:\python27

If you are using Mac

or Linux then you need not download anything as python comes preinstalled.

0.1 A Code Editor (optional)

A python program, or any program for that matter is just a text file that can be edited directly using any text editor. However, it is strongly recommended that you use a proper code editor since python uses whitespace (tabs and spaces, that is) to determine which block does a statement belong to.

Recommended Editors :

Notepad++ (Windows) http://notepad-plus-plus.org/

JEdit (Any OS) www.jedit.org/

Pico (Linux/Unix)

Vim (Linux/Unix)/gVim(Windows) – For advanced users

Emacs (Any OS) www.gnu.org/software/emacs/

Do not use Notepad or Wordpad to write code.

1. A Tutorial Introduction

Now that you have python, go ahead and open up a terminal, type “python” (without quotes) and hit enter.

You should have a window that looks like this

The Python Interpreter

This is the Python Interpreter. The text on the top tells the version of python that you are using , the ‘»>’ is the prompt – it means python is ready and is waiting for you command !

Type

print 'Hello, World!'

You’ll see Hello, World on the next line of the terminal.

Congratulations ! You just wrote your first program in python !

The command print takes a string(that is anything enclosed between quotes) and displays it on the terminal.

The python Interpreter can do a variety of things – mathematical calulations, string manipulations, list creation and a lot more.

2. What next ?

You might want to check out the following links

http://www.codecademy.com/en/tracks/python

http://www.learnpython.org/

and work on the basics of python.

We’ll start with real-life applications in the next post.

Automotive Locking Systems

utomotive locks vary considerably in the types of locking mechanisms and lock arrangements. There are many other methods of gaining access to an automobile which are quite often quicker and easier than attempting to pick the lock Continue reading

The Arts of Lockpicking

Published on June 13, 2015

Implementing the Caesar Cipher

Published on November 01, 2014