Skip to main content

Python Tutorial 2.1 - Python Syntax & Structure

# Python Syntax & Structure

Welcome to the "Python Syntax & Structure" tutorial!

## Overview

In this lesson, we cover the fundamentals of Python’s syntax and how the language’s structure works. This includes:

- **Indentation:**  
  Python uses indentation (typically 4 spaces) to define code blocks instead of braces.

- **Comments:**  
  Single-line comments use `#` and multi-line comments can be written with triple quotes (`""" ... """`).

- **Code Blocks:**  
  How statements are grouped together using indentation.  
  For example:
  ```python
  if True:
      print("This is indented!")
  ```

- **Semicolons and Newlines:**  
  Python generally uses newlines to separate statements. Semicolons may be used to separate multiple statements on one line but are not common.

## Key Takeaways

- Consistent indentation is essential in Python.
- Use comments to explain your code.
- Familiarize yourself with the overall structure to write clear, readable code.

Happy coding!

Comments