45 lines
No EOL
1.2 KiB
Markdown
45 lines
No EOL
1.2 KiB
Markdown
---
|
|
title: pythonSyntaxOverview
|
|
tags:
|
|
- python
|
|
- syntax
|
|
- overview
|
|
- basics
|
|
aliases:
|
|
- python syntax
|
|
- syntax reference
|
|
- python basics
|
|
---
|
|
|
|
> [!note] Overview of Python Syntax
|
|
> Python emphasizes **readability and simplicity**. Its syntax is designed to be clean, consistent, and human-friendly.
|
|
>
|
|
> Key syntax elements include:
|
|
> - **Indentation** instead of braces for code blocks
|
|
> - **Colons `:`** to begin blocks (like loops, functions, conditionals)
|
|
> - **Comments** start with `#` and are ignored by the interpreter
|
|
> - **Snake_case** for variable and function names
|
|
> - **Whitespace** matters for structure, not between expressions
|
|
>
|
|
> > [!example] Minimal Example
|
|
> > ```python
|
|
> > # This is a comment
|
|
> > def greet(name):
|
|
> > print("Hello,", name)
|
|
> >
|
|
> > if True:
|
|
> > greet("Void")
|
|
> > ```
|
|
>
|
|
> > [!tip] Syntax Philosophy
|
|
> > - “There should be one — and preferably only one — obvious way to do it.” — The Zen of Python
|
|
>
|
|
> > [!info] Related Notes
|
|
> > - [[variableNamingRules]]
|
|
> > - [[variableNamingBestPractices]]
|
|
> > - [[comments]]
|
|
> > - [[booleans]]
|
|
> > - [[arithmeticOperators]]
|
|
> > - [[typeConversions]]
|
|
> > - [[conditionals]]
|
|
> |