Getting Started with Python

Getting Started with Python

Contents

What is Python?

Python is an open source general purpose programming language. It is designed in such a way to improve software quality, developer productivity, program portability and component integration. Python gives more importance to its code readability and its syntax allows programmers to program their idea in fewer lines of code than other programming languages like C does. It is used all round the globe for web designing, system programming, user interfaces, product customization, numeric programming etc.

Why Python?

Python language  is simple, readable and has a easily maintainable syntax. Object Oriented, functional and modular structures are possible in Python. It has a good collection of precoded interfaces and utilities. Its very flexible and agile language. It is often referred to as general purpose language. Python is also used in system programming, Graphical user interface creation, Internet programming including accessing network protocols HTTP, emails and FTP. Unlike traditional Programming languages python is flexible. The standard libraries in python includes everything from asynchronous processing to zip files. It has dynamic introspection capabilities and advanced features such as meta-classes, duck typing and decorators.

Downloading and Installing PYTHON GUI

Python Shell
Python Shell

Any tutorial for a programming would should start with a “Hello World”. So lets start with the same. In the GUI type the following print statement.

print ("Hello World")

Note : In Python 2.x “print” is not a function, it is a statement. So parenthesis is not needed in Python 2.x versions.


Then press Enter. You can see the output directly in the interpreter as shown below.

Python Hello World
Python Hello World

This is how the interpreter works. To execute a single command this is all that is required. But as you may know as the program becomes lengthy using the interpreter is not practical. So we will write programs having more than one line in a Python File. You can use text editor or python editor for this purpose.

  • Click File >> New
  • It will open a text editor and type the following program there.
for i in range(0,10):
   print("Hello World")
  • Save It
  • Run >> Run Module

In this example “Hello World” is printed 10 times using a for loop. The value of i will be incremented from 0 to 9. The output will be displayed at the Shell as shown below.

For Loop - Hello World
For Loop – Hello World

Note : Python doesn’t require semicolon (;) at the end of a statement. There is no error if you use semicolon. Semicolon can be used when you need to write more than one statement in a line.

Share this post


  • >