Learn Python Programming

Python Basic Syntax

Python program can be executed by writing program directly in the Command Line:

Python Indentions

Python provides no braces to indicated blocks of code for classes or functions definitions or flow control. Instead of braces, Python uses line Indentation to indicate a block of code.

if 5>2:
   print("Five is greater than Two!")

Note – Python will throw an error if you skip the indentation.

Python Comments

In Python, # symbol is used to commenting. All characters after the # and up to the end of the physical line are comment and Python ignore them.

#This is a comment
print("Hello, Python!")

Python Docstrings

Python also has multi-line commenting capability. Docstrings can be one line, or multi-line.
Python uses Tripple quotes at the beginning and end of the docstrings.

 """This is a 
multiline docstring."""
print("Hello, World!")