Introduction to Python Programming

Similar to other scripting languages Python has got more support online from technical forums and strong base made it popular.
It is easy to code in Python rather than most other programming or scripting languages.

One can test simple python commands on python shell invoked on any OS prompt like DOS shell or terminal on windows.

virtual-machine:~$ python3
Python 3.6.7 (default, Oct 22 2018, 11:32:17)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

Note: This is Python3 course, so there are slight differences in python2 and python3. Please be aware of it.

A simple and famous "Hello World" program in python is as simple as below.

>>> print ("Hello World \n")
Hello World
>>> exit()
Above exit function is to close the interactive shell.

To write code in a file and execute it then follow the steps below. Single step code is written in a file test.py and executed using "python3 test.py" on linux terminal.

virtual-machine:~/python3_examples$ cat test.py
print ("Hello World \n")


virtual-machine:~/python3_examples$ python3 test.py
Hello World



No comments:

Post a Comment

Featured Post

Introduction To Groovy Programming

Starting with the first program printing "Hello World". There is no interactive shell available like other scripting langugages t...