Python Online Course

Lesson 1: What is Python?

Python is a powerful, easy-to-learn programming language used in apps, AI, games, data science, automation, websites, and more.

print("Hello, Python!")

Lesson 2: Variables

Variables store data. Python creates them automatically when you assign values.

x = 10
name = "Alex"
pi = 3.14

Lesson 3: Data Types

Common Python data types:

Lesson 4: If Statements

If statements make decisions in programs.

age = 18
if age >= 18:
    print("Adult")
else:
    print("Minor")

Lesson 5: Loops

Loops repeat code multiple times.

for i in range(5):
    print(i)

x = 0
while x < 5:
    print(x)
    x += 1

Lesson 6: Functions

Functions are reusable blocks of code.

def greet(name):
    print("Hello", name)

greet("Alex")

Lesson 7: Lists

fruits = ["apple", "banana", "orange"]
print(fruits[0])

Lesson 8: Dictionaries

person = {"name": "Alex", "age": 15}
print(person["name"])

Lesson 9: Classes (OOP)

class Dog:
    def __init__(self, name):
        self.name = name

mydog = Dog("Buddy")
print(mydog.name)