Programming

Python..a wonderful Language to Learn..

python-snake

Python is a opensource programming language created by Guido van Rossum  in 1991.He invented this awesome language where he wanted to  use a better user level language for the operation system “amoeba”.A short and brief introduction of his project and himself can be viewed by clicking here.

People use Python for many purposes, to make games, build web applications, solve business problems, and develop internal tools at all kind of interesting companies.Python is also used heavily in scientific fields for academic research and applied work.From this post I will show you how to install python to Windows-OS and write a simple program using Python.. Lest start…

The easiest way is with Windows-OS, install python and notepad++. The official web site to download python can be directed from HERE, or you can download it from a very cool site ninite.com. From this site you can download both Python and notepad++.For my coding purpose I use python 2.7.11, you can use latest version 3.5.1.The installer will detect what Windows version you are using and which platform i.e. 32bit or 64bit. It will then download the correct versions and install them for you automatically.

installing
Figure 1: Installation Python

Installing is simple as it does not need a specific knowledge ,just like installing a drive for your machine

install2
Figure 2: Assigning a Drive, default settings are here

After installing go to the search bar and type python and you will see a python command line desktop application, Just click it and you will find a command-line interface as follows

cmd
Figure 3: Python Command Line Interface

Hope you have downloaded notepad++ too. So let’s write our 1st program to print ‘Hello Python’.In the 1st step you have to open notepad++ and write this.

# My 1st Program

print ‘Hello Python’

In Python for comments “#” mark is used, and end of a statement don’t  need to put a semicolon.After writing this save it as ABC.py where ABC is any name and py is python extension to save ( Like hello.c in C programming). After saving the document in notepad++, you can clearly see that codes that you wrote became colored as follows.

save
Figure 4: Saving the 1st Program on notepad ++

After saving the file, no need to compile, just need to direct the file where are you from command line interface.

cmd1
Figure 5: Directing to the file where it saved from command line

(To changing a directory file “cd” keyword is used to see what’s inside a folder “dir” is used ). After directing  to the relevant folder you just need to type the name of the file you saved, in my case hello.py. So after typing this you can see your 1st program output from command-line as follows.

1stprogram
Figure 6: Output of the program

So, we did our 1st programming code and got the output “YAY”..

PS:

If  you want to learn more  I will recommend a free course provided by Dr  Charles Severance. The link is  here.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s