Python Tutorials

Python Programs

Python Basic Syntax


Python Basic Syntax

In this tutorial, we will learn the basic syntax of Python language. We will go through the key components of a simple Python program.

Python Program

print("Hello, World!")

Output

Hello, World!

Basic Syntax of a Python Program

  1. print("Hello, World!")
    This line uses the print function to output the string "Hello, World!" to the standard output (usually the screen).

Key Points to Remember

  • All Python statements must end with a newline character, although a semicolon can be used to separate multiple statements on the same line.
  • Python uses indentation to define code blocks, so proper indentation is crucial for code readability and execution.
  • Comments can be added using # for single-line comments or """ ... """ for multi-line comments.
  • Python is case-sensitive, meaning that print and Print would be considered different.