How To Start With Python Language? – A Guide For Beginners

In this article, I am going to define the step to step guide to the Python language. All queries related to how to download the Python, how to install the Python and how to begin to write your first program, will be solved in the write-up.

I have tried to combine all the above-listed things on a single platform, in my blog. I hope this tutorial will be much more helpful for those who have never used the Python language.

Kindly follow these steps and you are done!

Requirement for Windows Platform

The Python download requires about 30 Mb of disk space; keep it on your machine, in case you need to re-install Python. When installed, Python requires about an additional 90 Mb of disk space.

Downloading Process

The whole process or its downloading is listed below:

  1.  Navigate the URL https://www.python.org/downloads/
    The following page will appear in your browser.
  2. Click on button Download Python 3.6.2
  3. The downloading should start with the file named python-3.6.2.exe into your standard download folder. This file is about 30 Mb so it might take a while to download fully if you are on a slow internet connection (it took me about 10 seconds over a cable modem).
    The file will be visible as:
  4. Move this file to a more permanent location, so that you can install Python and  reinstall it easily later, if required.
  5. Fell free to explore this webpage further, if you want to just continue the installation, you can terminate the tab browsing this webpage.

Installation Process

For the easy installation process, follow the instructions listed below:

  1. Double click on the icon labeling the file python-3.6.2.exe.
    Pop-up window will appear with the title like Open File – Security Warning.
  2. Click on Run button.
    A Python .3.6.2(32-bit) Setup pop-up window will appear.At the bottom of the screenshot, ensure that both of the checkboxes(Install Launcher for all users(recommended) and Add Python 3.6 to PATH).
    If the Python installer finds an earlier version of Python installed on your machine, the Install Now message will instead appear as Upgrade Now and checkboxes will not appear.
  3. Select Install now or Upgrade now message as per requirement.
  4. A pop-up window will appear with the title like User Account Control with a highlight question, Do you want the allow the following program to make changes to this computer?

  5. Now click on Yes button.
    Pop-up window will appear with title like Python 3.6.2 (32-bit) setup with a Setup Progress message and a progress bar.It will show the various components it is installing and move the progress bar towards completion during the installation.
  6. Finally, a new Python 3.6.2 (32-bit) Setup pop-up window will appear with a Setup was successfully message.
  7. Click on the Close button.
    Now set up has been done.

How to Verify The Installation?

  1. Go to the directory from where you run the file Python.exe (see the pop-up window for Installing step 3).
  2. Or if you have installed in default directory then navigate to C:\Users\Pattis\AppData\Local\Programs\Python\Python36-32
  3. Double click on icon or file python.exe
    The following pop-up window will appear A pop-up window with the title C:\Users\Pattis\AppData\Local\Programs\Python\Python36-32 appears, and inside the window; on the first line is the text Python 3.6.2 (notice that it should also say 32 bit)
  4. Inside the window, at the bottom left, is the prompt >>>
  5. To terminate the Python, type exit() to this prompt and press the Enter button from keyboard.For your safe hand, you should keep the file python.exe somewhere on your machine, in case you need to reinstall Python.

How to Write the First Program in Python?

Open your text editor

You can quickly create a test program that will get you familiar with the basics of creating and saving programs and then running them through the interpreter. This will also help you test that your interpreter was installed correctly.

Follow these steps to open the IDLE editor:

  1. Go to the default location where IDLE shortcut is kept like:
    C:\Users\dell\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Python 3.6
  2. Now double click on the shortcut IDLE (Python 3.6 32-bit)
  3. You will see a editor window where you can write your code.

 

Create a “print” Statement

“Print” is one of the basic functions of Python, and is used to display information in the terminal during a program. Note: One thing keep in mind there is a change from Python 2 to Python 3. In Python 2, you only needed to type “print” followed by what you wanted displayed. In Python 3, “print” has become a function, so you will need to type “print()”, with what you want displayed inside the parentheses.

Add your Statement

One of the most common ways to test a programming language is to display the text “Hello, World!” Place this text inside of the “print()” statement, including the quotation marks like below:

Unlike many other languages, you do not need to designate the end of a line with a ;. You also will not need to use curly braces ({}) to designate blocks. Instead, indenting will signify what is included in a block.

Save the File

  1. Click the File menu in your text editor and select Save.
  2. In the drop down menu beneath the name box, choose the Python file type.
  3. If you are using Notepad (not recommended), select “All Files” and then add “.py” to the end of the file name.
  4. Make sure to save the file somewhere easy to access, as you will need to navigate to it in the command prompt.
  5. For this example, save the file as “hello.py“.

Run the Program

  1. Open your Command Prompt or Terminal.
  2. Then navigate to the location where you saved your file.
  3. Once you are there, run the file by typing hello.py
  4. Now press ↵ Enter.
  5. You will see the text Hello, World!, displayed beneath the command prompt.

Note: Depending on how you installed Python and what version it is, you may need to type python hello.py or python3 hello.py to run the program.

Another way to run the Python Program

There is also another way from where we can run your python program, the way us called run from IDLE editor.

To do this:

If your file is saved(If not first of all you need to have save the file) follow the these instructions:

  1. click on Run  menu.
  2. now click on Run Module.
  3. Or you can directly press F5 key.
    you will see the out put like:

Note: These are just the basics when it comes to Python. Although it’s one of the simplest languages to learn, there is quite a bit of depth if you are interested in digging. The best way to keep learning is to keep creating programs!For more technical blogs visit https://www.loginworks.com/blogs/

Leave a Comment