Python Syntax & Variables

What is Syntax

Syntax is the set of rules that define how Python code must be written and structured to be understood and executed by the interpreter.
# This is a comment
print("Hello, World!")

Variables in Python

Variables are used to store data. You don’t need to declare the type explicitly — Python handles that for you.

name = "John"
age = 25
is_student = True

Dynamic Typing

Python supports dynamic typing, which means you can reassign a variable to a different type.

x = 5       # integer
x = "text"  # now a string

Scope and Use Cases

Python is used in a wide variety of fields: