codegurukool.com · Free coding tutorials & online compiler

Home › Python Tutorial › Python syntax and comments

Python syntax and comments

Indentation is part of the language.

Python uses indentation (usually 4 spaces) to mark blocks of code instead of curly braces. Comments start with #. A triple-quoted string can act as a multi-line comment.

Example code

# Indentation defines the block
if 5 > 2:
    print("Five is greater than two")

"""A triple-quoted string
can span many lines"""

Run this code in the online editor

← Python installationPython variables and output →