Category Archives: Python

Downloading and Installing Python

Before we start, we need to install Python on our system.
So, navigate to the downloading page of Python by entering the following URL in your browser :
https://www.python.org/downloads/

Windows:

1. The following page will appear in your browser.
pic1

2. Click the Download Python 3.4.1 button.
–> The file named python-3.4.1.msi should start downloading into your standard download folder. This file is about 24 Mb.
The file should appear as
pic2

Installation

1. Double-click the icon labeling the file python-3.4.1.msi.
–> An Open File – Security Warning pop-up window will appear.
pic3

2. Click Run.
–>A Python 3.4.1 Setup pop-up window will appear.
pic4

Make sure that the Install for all users radio button is selected.

3. Click Next > button.
–> A new Python 3.4.1 Setup pop-up window will appear (Select Destination Directory).
pic5

The default directory will appear in the bottom as C:\Python34\

4. Click the Next > button.
A new Python 3.4.1 Setup pop-up window will appear (Customize Python 3.4.1).
pic6

Use the default customization, which selects the Python Interpreter and all its libraries (about 42 Mb).

5. Click the Next > button.
In a few seconds a pop-up window titled User Account Control will appear, posing the question Do you want the following program to install software on this computer ?
pic7

6. Click the Yes button.
–> A new Python 3.4.1 Setup pop-up window will appear (Install Python 3.4.1).
pic8

During installation, it will show the various operations it is performing and a progress bar for each one.

Eventually a new Python 3.4.1 Setup pop-up window will appear (Complete the Python 3.4.1 Installer).
pic9

7. Click the Finish button.

Python should now be installed. To try to verify installation, navigate to the directory C:\Python34 (or to whatever directory on which you installed Python) double-click the icon/file python. The following pop-up window will appear.
pic10

A pop-up window with the title C:\Python34\python.exe appears, and inside the window on the first line is the text Python 3.4.1 … (notice that it should say 32 bit).
Inside the window, at the bottom left, is the prompt >>>: type exit() to this prompt and press enter to terminate Python

NOTE: You need to have JAVA installed on your machine for Python.

MAC:

1. The following page will appear in your browser.

mpic1

2. Click the Download Python 3.4.1 button.
An Opening python-3.4.1-macosx10.6.dmg pop-up window will appear
mpic2

Click Save File.

The file named python-3.4.1-macosx10.6.dmg should start downloading in your standard download folder.

The file should appear as
mpic3

Installation

1.Double-click the icon labeling the file python-3.4.1-macosx10.6.dmg.
–> A file folder named Python 3.4.1 containing the Python.mpkg file will appear.
mpic4

2. Control-click on the Python.mpkg file and select open.

If the following pop-up window appears
mpic5

enter you password and click Install Python

An Install Python pop-up window will appear.
mpic6

3. Click Continue button.
–> A new Install Python pop-up window will appear.
mpic7

4. Click the Continue button.
–> A new Install Python pop-up window will appear.
mpic8

5. Click the Continue button.
–> A new pop-up window asking you to agree to the license terms will appear.
mpic9

6. Click Agree.
–> A new Install Python pop-up window will appear.
mpic10

By default Python will be installed in your Hard Disk Drive Machintosh HD/Applications/Python3.4.

7. Click Install.
–> The previous pop-window will reappear, displaying the message
Install Python 3.4.1

Please wait while the Installer installs Python 3.4.1. This may take
several minutes.

During installation, it will show the various operations it is performing and a progress bar for each one.

Eventually a new Install Python pop-up window will appear.
mpic11

8. Click the Close button.
–> Python should now be installed. To try to verify installation, navigate to the directory Machintosh HD/Applications/Python3.4
double-click the icon/file IDLE. The following pop-up window will appear.
mpic12

A pop-up window with the title *Python 3.4.1 Shell* appears, and inside the window on the first line is the text Python 3.4.1 ….

Click the red (terminate) icon to terminate this pop-up window.

NOTE: You need to have JAVA installed on your machine for Python.

Knowing the System Type (i.e whether it has a 32/64 bit Operating System)

Your system can be Windows/MAC/Linux etc

It can be  32 or 64 bit Operating System.
Before installing Python we should be aware about our System Type (i.e whether it has a 32/64 bit Operating System).

To know the System Type (i.e 32/64 bit Operating System) you can do this :

For Windows :

Windows 8
1. Swipe in from the right edge of the screen, and then tap Search. or, if you are using a mouse, point to the lower-right corner of the screen, and then click Search.
2. Type System in the search box, and then tap or click Settings.
3. Tap or click System.
4. If you are running a 64-bit version of Windows 8, 64-bit Operating System is displayed in the System type field under the System heading. If you are running a 32-bit version of Windows 8, 32-bit Operating System is displayed in the System type field under the System heading.

Windows7/vista
1. Open System by clicking the Start button , right-click Computer, and then click Properties.
2. Under System, you can view the system type.

WindowsXP
1. Click Start.
2. Right-click My Computer, and then click Properties.
3. If you don’t see “x64 Edition” listed, then you’re running the 32-bit version of Windows XP.
4. If “x64 Edition” is listed under System, you’re running the 64-bit version of Windows XP.

[For more Refer : http://support.microsoft.com/kb/827218]

 

For MAC:

1. Choose About This Mac from the Apple  menu in the upper-left menu bar, then click More Info.
2. Open the Hardware section.
3. Locate the Processor Name.

pic

4. Compare your Processor Name to information below to determine whether your Mac has a 32-bit or 64-bit processor.

pic13

[For more Refer :http://support.apple.com/kb/HT3696]http://support.apple.com/kb/ht3696 ]

 

For Linux :

1. Open a terminal window (Applications > Accessories > Terminal).
pic12. In the terminal window, type in
pic2and hit enter key
–> If the response is i686, you have a 32-bit version of Linux.
–> If the response is x86_64, you have a 64-bit version of Linux.

Note: If you get some other value like i386, you almost certainly have a 32-bit version of Linux

Questions/Queries !!!

But Why Python ???

Of course, you have to start with something 😛
On a serious note  I think Python is easy to understand(although some may not quite agree with me) when first learning how to program.
It is a great starter language that is also quite powerful when you get familiar with it. Used for many web applications and even some games.

Before starting few basic questions:

Q. What is a Program and what’s it’s use ?
A. A program is a list of step by step instructions telling the computer how to do something.

Q. How does the computer understand the program written by the user ?
A. Computers understand binary/machine language: 01011101.
In order to make a computer understand higher-level languages you need to use a compiler or interpreter.

Q. What do you mean by Higher Level Language [HLL] ?
A. A programming language such as Python enables a programmer to write programs that are more or less independent of a particular type of computer. Such languages are considered high-level because they are closer to human languages and further from machine languages.
The main advantage of high-level languages over low-level languages[assembly language]  is that they are easier to read, write, and maintain. Ultimately, programs written in a high-level language must be translated into machine language by a compiler or interpreter.

Q. What do you mean by a compiler or interpreter ?
A. A Compiler and Interpreter both carry out the same purpose – convert a high level language (like Python) instructions into the binary form which is understandable by computer hardware.
They are the software used to execute the high level programs and codes to perform various tasks. Specific compilers/interpreters are designed for different high level languages
However compiler and interpreter differ in the way the convert high level language into machine language.

Q.  So what exactly is the difference between a compiler and interpreter ?
A. – The interpreter takes one statement then translates it and executes it and then takes another statement. While the compiler translates the entire program in one go and then executes it.
– Compiler generates the error report after the translation of the entire page while an interpreter will stop the translation after it gets the first error.
– Compiler takes a larger amount of time in analyzing and processing the high level language code comparatively interpreter takes lesser time in the same process.
– Besides the processing and analyzing time the overall execution time of a code is faster for compiler relative to the interpreter.
Referencehttp://www.youtube.com/watch?v=kmQUB-5cEgM

Finding Your way !!!

I wanted to undertstand and learn SQL [Structured Query Language. It lets you access and manipulate databases], then I realised that a lot of programming languages are very similar, and knowing what’s common between all programming languages will help you transition into any other programming language if you need to !!!
So I thought that it will be good to understand those concepts before learning/understanding any programming language.

So I will try and explain the basic concepts of Programming with the help of Python programming language. 🙂

I want this content to provide anyone “walking on the street” the knowledge to be able to write their first program with the Python programming language with as little pain as possible 🙂
and I hope I am able to do so 😉