Python Syntax Basics

Első programKommentek

Python has a clean and readable syntax that emphasizes simplicity. Unlike many languages, Python uses indentation to define code blocks instead of braces or keywords.

This lesson covers the core rules you need to write valid Python code.

Indentation – Defining Code Blocks

Python uses spaces (usually 4) to group statements into blocks. Consistent indentation is required.

Wrong indentation causes IndentationError.

Statements and Line Continuation

A statement is a single instruction. Python reads one statement per line, but you can continue with \ or parentheses.

Case Sensitivity

Python is case-sensitive: Name and name are different variables.

Multiple Statements on One Line

Use semicolon ; to separate statements (not recommended for readability).

Best Practices for Syntax

  • Use 4 spaces for indentation (PEP 8 standard).
  • Avoid mixing tabs and spaces.
  • Keep lines under 79 characters when possible.
  • Use parentheses for long expressions instead of \.

Quick Quiz

Az anyagokat átnéztük és ellenőriztük, de hibák továbbra is előfordulhatnak. A tartalom kizárólag oktatási célt szolgál, ezért saját felelősségre használd, és szükség esetén ellenőrizd más forrásokkal is.

✨ Kérdezd Larát — a tanulási partnered

Fedezd fel a személyre szabott tanulási támogatást. Lara elmagyarázza az anyagot, összefoglalja a témákat és megválaszolja a kérdéseidet — az Go csomagtól elérhető.


Lara segít gyorsabban tanulni — kizárólag a ReadyTools Go, Plus és Max tagoknak.

Kövesd nyomon a fejlődésed 🚀

Tanulj egyszerűbben utad nyomonkövetésével teljesen ingyen.