3. Basic Python Syntax
3. Basic Python Syntax
Python syntax is designed to be clear and readable:
Indentation is used to define code blocks
Comments start with #
Statements typically end with a newline
Code is written in plain text files with a .py extension
Use of colons to start new code blocks
# Example code:
# This is a comment
print("Hello, World!") # This prints "Hello, World!"
if True:
print("This is indented")
if True:
print("This is further indented")
Last updated