Installation Of Python

Let us install the Python step by step to create python setup on windows and possible ways to run the code.

Let us see how to download Python :

  • Navigate to https://www.python.org/ and the main page for python software will open.
    python-download-page
  • Click on the Download button as shown in the above image, you will see the latest version of the python as 3.7.3 and then click on the View the full list of Downloads
    click-on-downloads
  • If you scroll down, you can see the list of python released versions.
    list-of-python-released-versions
  • Once you click on the view the full list of downloads, Download the latest version for windows page will display, where you can select Windows as your Operating system.
    download-latest-version-page
  • In the next page select, the Download windows x86 executable installer and click on that.
    select-the-version
  • Once you click on it, it will ask you to select the folder to save the .exe file and hence select the file name and save it, so it will start downloading
  • Now it starts downloading the .exe file.
  • Once it completes downloading the installer, just right click on it and click on Open
    start-downloading
  • Now python is going to Run this software in your operating system so just click on the Run button.
    select-run-button
  • Once you click on Run, next the install python page will open, in that you can see two options as install now and customize the installation, most recommended one is Install now this is nothing but a default installation, so select install now, an also one more important thing is that at the bottom there is an option called Add python 3.7 to path, select it and then it will start installing python software on your OS.
    select-add-path

    set-up-in-progess
  • If it is successfully installed then you will see the below and then close this page
    successfully-installed
  • To confirm whether python is installed in your OS or not, you can check by typing Python in your windows, if it is installed then you can see Python on windows.
    python-on-windows
  • And also type Python in your command prompt, it will display you with its version if it is successfully installed.
    python-on-cmd-pmpt
  • Once you complete this, you can check for the path selection, that means while installing you selected Add Python 3.7 to Path, so you can also see the proof for that.
  • Just go to My Computer and select properties by right-clicking on it.
    my-computer-properties
  • Select Advanced System Setting in the Control Panel Home page.
    advanced-system-setting
  • Next click on Environmental Variable under System propeties.
    click-on-envrn-variable
  • And next, under the User variables, select the path and click on Edit button, here you can see the Python Path Location.
    edit-path
  • So, if you want to see this in clear just copy and paste it in Notepad so that you can see the Python location clearly.
    python-location-notepad

    Python Mutability

Working with IDLE Python

As we all know Python is an all-rounder, so it is a scripting language supported by different platforms like Linux, Windows, Perl, etc..And also it is platform independent so that we can just download and run the program anywhere, but in a practical way, we need some Editor.

The IDLE, which is nothing but an Integrated Development Environment for Python, Python IDLE is a simple editor which provides the Basic Features of Integrated Development Environment.

This is also called a REPL tool where R means Read, E means Evolve and P means Print, L means Loop, this tool helps us to work with Python syntax easily and also the IDLE helps in an only small type of applications and not for big applications

Now let us see how to use this Python IDLE

  • Just go to windows and type IDLE Python, you will it with its current version

idle-python

  • So once you click on that, the Python shell page will open, you can write the codes here.
    python-shell
  • For example, I am going to write it as 10+20 and press enter, it will return the output as 30
    10+30​
    Output:
    output
  • In the next example, am going to write it as 20>50 let us see what it will return
    10>50​

    Output:
    second-output

And also we can save the codes in the Python IDLE, let me show you how to do that, on the top of the Python shell page, you will see some tabs like File, Edit, Run, Debug, etc.. write some code by clicking on a file and then save it in your project folder.

different-tabs

writing-program-in-file

Now I am going to save this file as Demo.py file in my project folder called Python codes saving-demo-file

As this is a Python program, you need to save this by using .py extension and to Run this code there is Run Tab, just right click on it and click on Run Module so that Python will run the code and execute the output or else you can use the short cut to run just by clicking on F5 button.

click-on-run-tab

#Read a number from the keyboard and print welcome message those number of times
n = int(input('Enter some Number:')) 
for i in range(n):
    print('welcome to Chercher.tech')

The Output is :

output-of-demo-py

We can also execute the programs by using the command prompt, so just go to windows and type cmd, the command prompt page will open and now enter as python so you are directed to python shell so now you can enter the input as Print('Hello World').

Print('Hello World')

executing-program-in-cmd

And also you can see some more examples which I executed in the command prompt

20+3020<50

And I will get the output as below:

Out-puts-for-cmd-input

We had written code by using the IDLE and saved asDemo.py so we can execute this by using the command prompt as

First, open the cmd and then cd into the folder where you have saved the demo files, which you are worked on Python IDLE and then enter the file name followed by Python

exe-demo-file-from-cmd

As we have saved the program, once we run it, it will ask us to enter the number to print the output those many times, so here it is asking us to enter the number.

Python Bytes and Bytearray

Working with Python by using Notepad

In the previous section, we have learned how to write the program in IDLE and how to run that program by using the command prompt, In the same way, we can write and run the program by using the Notepad.

First thing is, you have to install the Notepad or Notepad++ in your system and then open the notepad ++ page and enter the simple program to execute the sum and product of two numbers

#Read two numbers from the keyboard and print the sum and product 
n1 = int(input('Enter first Number:')) 
n2 = int(input('enter second Number:')) 
print('The Sum :', n1 + n2) 
print('The product:', n1 * n2)

After writing the program, save the same file by pressing ctrl+s and save as sample.py in the python project folder.

sample

Now open the command prompt and change the directory to your project folder, where I saved my Python project in the E folder and then move to your python codes folder and then run the code which we had written in the Notepad by using the command python sample.py

sample-command

If it is successfully run the code then it will ask you to enter the numbers, so give any two numbers and then it will reply with its sum and product

output-of-sum-and-product