In this chapter Python are very similar to other language php,perl etc.
Basic Python syntax
We can execute directly by using command line
>>>print ("Hello, world!")
We need to print statement with parenthesis as in print ("Hello, world!")
We can execute server side .py file extensionwindow
C:\Users\Your Name>python test.py
We can execute server side .py file extensionLinux
$ python test.py
This produces the following result −
Comments in Python
Comment are start with #, up to end of end of physical line are part of comment.
Comments are up to the end of the physical line are part of the comment.
# First comment
print "Hello, Python!"# second comment
Multi line comments allow the use of the line continuation character (\) to denote that the line should continue.
sum= item1 + \ item2 + \ item 3
Python the indentation is very important.ends with two trailing underscores, the identifier is a language-defined special name
print(" two is greater than one")
In the next chapter you will learn about variable