Back to Modules

Python Tutorial

Learn Python fundamentals with hands-on examples and clear explanations.

Video Tutorial

Introduction to Python

Python is a popular, high-level, interpreted programming language known for its simplicity and readability.

Examples:

print('Hello, World!')

Prints 'Hello, World!' to the console.

Variables and Data Types

Variables in Python do not need explicit declaration to reserve memory space. The declaration happens automatically when you assign a value to a variable.

Examples:

x = 5  # Integer
y = 3.14  # Float
name = 'Alice'  # String
is_active = True  # Boolean

Examples of different data types in Python.

Control Flow (if, for, while)

Python uses indentation to define blocks of code. Control flow statements like if, for, and while are used to control the execution of code.

Examples:

# If statement
x = 10
if x > 5:
    print('x is greater than 5')

# For loop
for i in range(3):
    print(i)

# While loop
count = 0
while count < 3:
    print(count)
    count += 1

Basic control flow examples in Python.