Monday, 25 May 2015

How to create hello program in python.

Requirements:
python 2.7

In linux based system python is pre installed. You can check, Just open your terminal and write in python and hit enter.

Am using Ubuntu Os.

 Terminal:
user@user-Lenovo-G50-30:~$ python                                                 # hit enter

You can see something like:

user@user-Lenovo-G50-30:~$ python
Python 2.7.6 (default, Mar 22 2014, 22:59:38)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

Now just create a variable and print.

a = 'welcome to python'
print(a)

Output will be: welcome to python

Sample:
Type "help", "copyright", "credits" or "license" for more information.
>>> a = 'welcome to python'
>>> print(a)
welcome to python
>>>

No comments:

Post a Comment