Python Syntax

format_list_numberedLesson 2 of 11schedule1 min readview_agenda2 sectionsauto_awesomeAI tutor ready
01

Execute Python Syntax

Python syntax can be executed by writing it directly in the Command Line, or by creating a .py file on your system and running it through the Python interpreter.

Example

The simplest Python program.

print("Hello, World!")
02

Python Indentation

Indentation refers to the spaces at the beginning of a code line. Where in other languages the indentation in code is for readability only, in Python the indentation is very important.

Python uses indentation to indicate a block of code.

Note

Python will give you an error if you skip the indentation.

Note

The number of spaces is up to you, but it must be at least one, and be consistent.