Skip to main content

Basic Syntax

Python stands out for its clear and readable syntax. It does not use curly braces or semicolons; instead, indentation defines blocks of code.

Basic rules

  • Instructions are written on separate lines.
  • Indentation (spaces at the beginning of the line) is mandatory.
  • Curly braces {} are not used to group code blocks.
  • The ; is not necessary at the end of each line.

Example:

name = "Anna"
if name == "Anna":
print("Hello, Anna") # This is inside the block