Let’s Learn Python

When you hear ‘python’, what comes to your mind? The big, bulky, non-venomous snake which kills its prey by constriction and asphyxiation. But hey, do you know that python is also a name for a programming language which can easily be learnt and is very user-friendly. People who are new to the coding world can also learn this language easily.

So to start with the tutorials, we first need to know the developer of such an amazing programming language. Python was developed by Guido Van Rossum in February 1991. Thanks Mr. Rossum. 🙂 Though it came into existence into 1991, it is a tough competition to the popular languages like C, C++, Java, etc.

Beginning with the learning, we shall first install the software.
1. You can download it for 32-bit Mac OS X from here
2. You can download it for 64-bit Mac OS X from here
3. You can download it for 32-bit Windows from here
4. You can download it for 64-bit Windows from here

After the installation, you are ready to work on it.

One can work in python in two different ways:
1. Interactive mode
2. Script mode

1.

Interactive mode

As the name suggests, you can interact with the language. You type any command and you get the output there and then. You do not need to write the entire code at once and get the output after that. Here, you are able to easily experiment with different commands. This mode has helped me a lot while I was learning python.

To work in interactive mode, follow the below mentioned process:
• Click Start button > All Programs > Python 2.7 > IDLE (Python GUI)
• It will open Python Shell where you’ll see 2-3 lines of text and then the Python prompt(‘>>>’)
• Typing commands in front of this Python prompt will fetch you the output.
• For example, you can try basic math problems like
2+5
15-2 etc.

2.

Script mode

Here, you need to write the complete code first and only then you can get the output. It is useful when you want to save all the commands in the form of a program file so that you can revisit the code again later.

To work in script mode, follow the below mentioned process:
• Click Start button > All Programs > Python 2.7 > IDLE (Python GUI)
• It will open Python Shell. Click File > New
• The new window that opens, will be our workplace for script mode.
• Here, we will write the code and save it in the form of a program file.
• For example, type the following command: print ‘Python is fun.’
• Click File > Save and then save the file with an extension .py .for instance, we name our program as Fun.py.
• Now, to run the program: Open the program file you created and go to Run > Run module.
You may also press F5 button.

I would prefer you to create a separate folder to keep all the programs you will learn throughout the tutorial at one place.

Leave a Reply

Your email address will not be published. Required fields are marked *