Home > Article > Backend Development > Python: Indentation, Comments
Hi All, Today i started to learn python.
INDENTATION
if 10>1 print("Ten is greater than one")
Should be use same no. of spaces in the same block of code otherwise will generate error.
if 10>1 print("Ten is greater than one") print("Ten is lower than one")
The spaces use different no. of counts in two diff block of code.
if 5 > 2 print("Five is greater than two!") if 5 > 2 print("Five is greater than two!")
COMMENT
Single Line Comment
#print("Hello Python") print("Hello Python")
Multi Line Comment
Since Python not have multi line comment. We will use # with each line which all we want ignore to read python.
#This is a comment #written in #just more than one line print("Hello, World!")
And as long as the string not assigned to a variable, python will read the line but then ignore it. We use triple quotes to use multi line comments.
""" This is a comment written in just more than one line """ print("Hello, World!")
The above is the detailed content of Python: Indentation, Comments. For more information, please follow other related articles on the PHP Chinese website!