Skip to lesson content
Dev4Hub

Lesson 2 of 11

Python Syntax

1 min read2 sectionsAI tutor ready

On this page2 sections
  1. 01Execute Python Syntax
  2. 02Python Indentation

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.

Hello World in Python

Python

The simplest Python program.

print("Hello, World!")

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.

You've reached the end of this lesson.

Mark it complete to keep your place in the course — it counts toward your progress and your streak.