What is python?
Python is a general purpose language. It means we can use it in any field like web development, software development etc. Python is a high-level, interpreted, interactive and object-oriented language. If you are facing programming then last line will irritated for you. Lets understand these words.
High level: It enables a programmer to write programs that are more or less independent of a particular type of computer. It is closer to human languages and further from machine languages.
Interpreted: Its implementations execute instructions directly, without previously compiling a program into machine-language instructions.
Interactive: It allows to modify the code even when code is in running.
Object-oriented language: It is a organised around objects. You can not understand this concept at this stage. We will discus it later.
NOTE: Many people consider that python is a scripting language. It is because you can write small modules and for many years python was used as a scripting language. But python is a general purpose complete programming language and you can do anything in Python. It also covers the properties of scripting languages.
What can I do with python?
As I told before, Python is a general purpose language and you can do everything from website development and gaming to robotics and spacecraft control. Some of the examples are Systems Programming, GUIs, internet scripting, component integration, database programming, rapid prototype, numeric and scientific programming, Gaming, Images, Data Mining, Robots, etc.
Advantages of python:
- Easy to learn, read and maintain: The syntax of python is just like simple English language. It is easy to learn and read. The code is very much visible so it is easy to maintain.
- A powerful standard library: From a features perspective, Python is something of a hybrid. Its tool set places it between traditional scripting languages (such as Tcl, Scheme, and Perl) and systems development languages (such as C, C++, and Java).
- Interactive Mode: Python has support for an interactive mode which allows interactive testing and debugging of snippets of code.
- Portable: The standard implementation of Python is written in portable ANSI C, and it compiles and runs on virtually every major platform currently in use.
- Extendable: You can add low-level modules to the Python interpreter. These modules enable programmers to add to or customize their tools to be more efficient.
- Databases: Python provides interfaces to all major commercial databases.
- GUI Programming: Python’s simplicity and rapid turnaround also make it a good match for graphical user
interface programming on the desktop. Python comes with a standard object-oriented interface to the Tk GUI API called tkinter (Tkinter in 2.X) that allows Python programs to implement portable GUIs with a native look and feel.
- Scalable: Very complex programs can be built in python.
- Speed: It is faster than PHP.
Weakness of python:
If you don't know any of the programming language then you can not understand these weaknesses at this stage. You will understand these limitations later.
- No faster than C, C++ and Java.
- Python has no ‘switch’ statement and ‘do … while’ construct
- increment and decrement and assignment operators (assignment is a statement only in Python)
- the ternary operator/statement (… ? … : …)
- an expedient (commonly installed) environment
- no private, protected and public modifiers for both properties and methods
- no abstract and final modifiers for both classes and methods
How to install python?
Download python from here Python for windows. During installation time check where you are installing it and add that location in path variable. For example you are installing in C:\Python27\ then open your control panel and do:
- Click on -> Control Panel -> System -> Advanced
- Click on Environment Variables, under System Variables, find PATH, and click on it.
- In the Edit windows, modify PATH by adding the location of python path ( C:\Python27\ ) to the value for PATH. If you do not have the item PATH, you may select to add a new variable and add PATH as the name and the location of the python path as the value.
- Save and close the window.
NOTE: Be careful and don't delete any entry. In case if PATH has already some value then place a semicolon ';' after that value and then place python path after it.