Friday, 4 December 2015

Python: Hello World program

Open any text editor and copy the statement “print ('hello world')” and save the file name as hello.py.

hello.py
print ('hello world')

Open terminal (or) command prompt, use the command ‘python3 hello.py’ to run the file hello.py. You will get output like below

$ python3 hello.py
hello world

What happens when you instruct python to run your script?
Python first compiles your source code to byte code and sends it to python virtual machine (PVM). Byte code is the platform independent representation of your source code. PVM reads the byte code one by one and execute them.


Note:
Byte code is not machine understandable code, it is python specific representation.



Previous                                                 Next                                                 Home

No comments:

Post a Comment