Introduction to Python – Part1

Python, I am going to write series of blogs about Python. I will show you from scratch how to write Hello World program in Python and will take up to advance level of programming specially in web development. As I am also new Python and going to learn this language. The reason I choose to learn Python is that, it is open source, it is very well matured language, as Google is using Python.  And Python is very easy to learn. There are number of free tools available to write code and learn Python. Even Microsoft is providing support for Python in its Visual Studio. You can use Microsoft Visual Studio to create applications using Python. Before learning Python I was thinking that it’s a scripting language only. But as I start learning about Python I find out that Python is not only used for web development but also used for following development purposes as well,

  1. Desktop GUIs
  2. Scientific and Numeric
  3. Network Programming
  4. Software & Game Development

History Of Python

Python was created by Guido van Rossum, while working on successor for ABC programming language. The first version of Python was released in 1989. And it start getting popularity among software developers.  Python 2.0 was released in Oct 2000 with a major change or enhancement in the language. Many new features were introduced. Python 3.0 was another major backward incompatible  release. And was released in December 2008.

Python interpreter is available for different OS like Windows, MAC OS, Linux etc. You can download Python from Python.org. Python, as I mentioned before not only easy to learn but it also support multiple programming paradigms few of them are Object Oriented programming, Structured programming, Imperative and functional programming. Its syntax allows to write less lines of code as compared to other languages like C++ or Java. And its syntax is much simple and looks clean.

Flavours of Python

Python is available in different flavours. Few of them I mentioned below,

  1. CPython: It’s  base of all the implementation. And it is written in C and have a bytecode interpreter.
  2. JPython: As name suggest it compiles the code into Java bytecode.
  3. IronPython: IronPython is written in C# and target dotnet framework.
  4. Pypy: Pypy is written in a language called RPython, which is suitable for writing dynamic interpreters.
  5. Stackless Python: It is kind of extension of CPython and is used to threading.
  6. Pythonxy: It is used for scientific and engineering related stuff.
  7. Portable Python: As name suggest you just need to extract this in any storage device and run directly from it. Its mainly for Windows OS.
  8. Anaconda Python: It’s used for large scale data processing and scientific computing.

To learn more about different flavours of Python of you can goto WikiPedia or search on Google.

Python tools for Visual Studio

Python tools are available for Visual Studio. Python tools are works best with CPython, but you can also use other programs that hosts python. The reason i am going to use Visual Studio for this series is that I already have Visual Studio and feel much comfortable while using it. And I can use Visual Studio for my Web And Window development as well. To use Python for Visual Studio follow the below steps,

  1. Install Visual Studio, If you don’t have Visual Studio you can download free community edition of VS.
  2.  Install Python tools for Visual Studio.
  3. Install a CPython interpreter. You can also download Anaconda or IronPython as well. But I am going to use CPython.

There are other open source or free IDEs available for Python as well you can use those if you don’t like to use Visual Studio.  The few other IDE are,

  1. PyCharm
  2. Wing IDE
  3. PyDev
  4. Komodo IDE

Hello Python

Let’s create first program in Python. Create new project in Visual Studio. Select Python template and select Python Application project. Name the project HelloPython.

HelloPython

Once the project is open, you can see that by default HelloPython.py file contain print(‘Hello World’) . So just run the application and you can see the output Hello World.

Leave a Reply