Recents in Beach

WHAT IS PYTHON PROGRAMMING LANGUAGE AND ITS INSTALLION IN WINDOWS

Hello Friends,
If you are interested in Programming language and want to learn programmimg language then I suuggest you to start learning Python language because it syntax(means rule to write code) is very easy and easy to understand.Many website like Blogger,Google, YouTube, instagram, use python. 
you can perform Artificial intelligency(A.I) ,Machine learning,Data Science, Image Recognition,Text processing and many more things in Python.

To know more about Python read the full article.


Content Table



What is Python Programming language?
what is Python programming language?

Python is a esay to learn language compare to c,c++,java,etc and Powerful programming language.It is object-oriented Programming language[ views as a group of objects that has internal data (property) and external accessing part of that data(methods) ].

Python is an example of a high-level language; other high-level languages you might have heard of are C, C++, Perl, and Java.

There are also low-level languages, sometimes referred to as “machine languages” or “assembly languages.” Loosely speaking, computers can only run programs written in low-level languages. So programs written in a high-level language have to be processed before they can run. This extra processing takes some time, which is a small disadvantage of high-level languages.

The advantages are enormous. First, it is much easier to program in a high-level language. Programs written in a high-level language take less time to write, they are shorter and easier to read, and they are more likely to be correct. Second, high-level languages are portable, meaning that they can run on different kinds of computers with few or no modifications. Low-level programs can run on only one kind of computer and have to be rewritten to run on another.

Two kinds of programs process high-level languages into low-level languages: interpreters and compilers
An interpreter reads a high-level program and executes it, meaning that it does what the program says. It processes the program a little at a time, alternately reading lines and performing computations. Figure 1-1 shows the structure of an interpreter.
Diagram show working of interpreter


A compiler reads the program and translates it completely before the program starts running. In this context, the high-level program is called the source code, and the translated program is called the object code or the executable. Once a program is compiled, you can execute it repeatedly without further translation. Figure 1-2 shows the structure of a compiler.
Diagram shows working of Compiler


Python is considered an interpreted language because Python programs are executed by an interpreter. There are two ways to use the interpreter: interactive mode and script mode.

In interactive mode, you type Python programs and the interpreter displays the result:>>> 1 + 1
2
The chevron, >>>, is the prompt the interpreter uses to indicate that it is ready. If you type 1 +
      1, the interpreter replies 2.

Alternatively, you can store code in a file and use the interpreter to execute the contents of the file, which is called a script. By convention, Python scripts have names that end with .py.To execute the script, you have to tell the interpreter the name of the file. If you have a script named dinsdale.py and you are working in a UNIX command window, you type python
      dinsdale.py. In other development environments, the details of executing scripts are different. You can find instructions for your environment at the Python website http://python.org.

Working in interactive mode is convenient for testing small pieces of code because you can type and execute them immediately. But for anything more than a few lines, you should save your code as a script so you can modify and execute it in the future.

The code in Python(script) is execute line by line means Python interpreter execute first line first then second then third and so on to last line.
If there is occur an error in anyone line then Python interpreter stop,show an error and next lines not execution.

Python is extensible: if you know to program in C language it is easy to add a new built-in function
or module to the interpreter.

Python has many versions like Python3 and Python 2.This article is based on Python3.
Their is less difference in Python3 and Python2 are diference in syntax(rule to write program).
For example :
In Python3 - print("enter that you want to displsy")
In Python2 - print "enter that you want to display"

TO know about Print function : Click here

Some basic about Python Programming: Click here

Features in Python:
1. Easy to code
2. Free and open Sources
3. Object oriented Language
4. GUI Programming support
5. High-level language
6. Extensible features
7. Python is Portable language
8. Interpreted language 
9. large Standard library



Disadvantage of Python:
1. Speed - Slower than c or c++ language
2. Mobile Development - python is not good for mobile development
3. Memory consumption - Python memory consumption is high
4. Runtime error - the error shows only up at runtime



Download Python:
Download for Windows : windows
Download for Linux/UNIX : source
Download for Mac OS X : mac-os x
Download for Other : other

Note : Installation of Python means installing Python interpreter, IDE, Modules-Date and time, FileI/O, sys, etc, and some other files. 

How to install and Setting Path of Python(Interpreter) in Windows
open the executable file(.exe) and check the add python to path Then click on the install  button.Now, It will show the installion progress.
when installion completed.You will see the 'Disable path lenth limit' window so, don't worry just click on close.
congratulations, you have successfully installed python.

If you've installed Python in windows using the default installion option,the path of the python executable file(means file with extension ".exe") wasn't added to the windows Path variable and you get an error when you type 'python' in cmd like this


And you need to enter the full path of 'python.exe' in cmd to run python like this


And if you want to run python by typing python in cmd then you need to setting the path of python.To add the Path, start the run box and enter sysdm.cpl


This should open the the system Properties window.Go to the Advanced tab and click the Environment variable button:

In the system variable windows,find the Path variable and click edit:

Now the new window open, click on New:

Now enter the file location of Python.exe and click on 'ok' and close all windows:

Now enter Python in cmd then you see like this:
Congratulations,This means Python successfully installed and work in your system.



Lets make First Python Program
This Program is for Python 3

Writing the "Hello,world" Program
To write "Hello,world" make a file name 'hello.py'
open the hello.py in a text editor and wirte our program:


Lets know about the code

1. print() is a built in function that tells the computer to perform an action to display 
   whatever we put in the parantheses.These built-in function are always available       for us to use in program.
   we can also define our own function that we construct ourelves through other elements.

2. Inside the parantheses of the print() function is a sequence of character- Hello,world - that is enclosed in quotation marks("").Any characters that are inside of quotation marks as string.

Running the "Hello,world" program

open cmd/terminal and type python (location of this file hello.py) like this and hit enter

Congratulaions! you have written the "Hello,world" program




                                         Thank you

Post a Comment

0 Comments