| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [View Raw Code] [Original HTTPS Page] |
Python Syntax compared to other programming languages
Where in other programming languages the indentation in code is for readability only, in Python the indentation is very important.
Python uses indentation to indicate a block of code.
if 5 > 2:
print("Five is greater than two!")Python will give you an error if you skip the indentation.
Python has commenting capability for the purpose of in-code documentation.
Comments start with a #, and Python will render the rest of the line as a comment:
#This is a comment.
print("Hello, World!")Python also has extended documentation capability, called docstrings.
Docstrings can be one line, or multiline. Docstrings are also comments:
Python uses triple quotes at the beginning and end of the docstring:
"""This is a
multiline docstring."""
print("Hello, World!")| Back | FazBrowse Home | New Git URL |