Python Example

Python code is simple and easy to run. Here is a simple Python code that will print "Welcome to Python".

A simple python example is given below.

>>> a="Welcome To Python"
>>> print a
Welcome To Python
>>>  

Explanation:

Here we are using IDLE to write the Python code. Detail explanation to run code is given in Execute Python section.

A variable is defined named "a" which holds "Welcome To Python".

"print" statement is used to print the content. Therefore "print a" statement will print the content of the variable. Therefore, the output "Welcome To Python" is produced.

Python 3.4 Example

In python 3.4 version, you need to add parenthesis () in a string code to print it.

>>> a=("Welcome To Python Example")
>>> print a
Welcome To Python Example
>>>