We will learn how to write python code and running it using Python.It is mandatory to install Python in our computer in order to excecute python programs in our machine, however you can use any online python compiler in platforms such as onlinegdb. We will first learn how to install Python Software in windows operating system then proceed further with python code excecution.
The latest version of Python in the end of year 2020 is Python 3.9.1. In is version has to varieties, a 32-bit and 64-bit. Depending of your operating system you can download by visiting the link: here Beneath the this link’s page, click “windows x86-64 executable installer”. The file name “python-3.9.1-amd64.exe” will be downloaded in your computer. Afterwards you can easily install Python by double clicking and following the instructions.
Install Nowas shown below.
When the Python setup installation is done, we can see a
Setup was successful message as shown below.
5. Click the close button.
startbutton on the task bar of the Windows 10 OS. Since all applications are displayed in alphabetical order, scroll down to P and view
Python 3.9folder, inside this folder you’ll see icons named:
IDLE (Python 3.8 64-bit) option. The Python’s Integrated Development environment(IDLE) GUI shall open.
Click inside the IDLE’s prompt ie.,
>>> and type
quit() to close the Python window. A prompt asking ‘Do you want to kill it?’ shall appear.
OK button to exit the IDLE window.
start button on task bar then click
Python 3.9 (64 - Bit) to open
Python command line displayed on a black screen.
The Python command line has same use case as Python IDLE by typing code and running it.
To quit from Python command line type
quit(), similarly as how we exit in IDLE.
When installing Python in our Windows Operating System, the path is automatically set to Python. We can verify the path to Python’s directory in Windows Operating System environment variables
this PC icon, then click the
Properties option as shown below.
It will display a page where we should click
Advanced system settings option.
Environment properties button.
path variable followed by
Edit text located at the right side of the Environment variable dialog window.
This will display all directory within the path.The directory can be observed by name Python\Python38-32\Scripts is added to the path.
5. Add a dot at the end of the directory and click
OK. (.) Dot represents where Python gets executed. Therefore the dot will enable Python to run on any directory.
There are mainly three ways of exucting Python programs.
Python command line and Python IDLE are generally termed as
interactive modes because the PVM executes the code immediately after a programmer types one line at a time.
System prompt is also referred as
non-interactive mode since the PVM has to execute the whole code after being written by a programmer.
click on your windows
start button then search for Python