MyWhiteBoard TrainingHome

PRACTICAL PYTHON COURSE

Python Programming from Basics to Practical Automation

Learn Python through small, clear programs. Each topic includes a runnable example that opens directly in Open Editor.

What you will learn

  • Write readable Python programs using values, conditions, loops, and functions.
  • Organize data with lists, dictionaries, sets, tuples, and classes.
  • Handle files, JSON data, errors, modules, and reusable code.
  • Use generators, decorators, testing, and automation patterns safely.

Practice method: run each sample in Open Editor, change one value, predict the outcome, and run it again.

1. Core language basics

Readable values and output

Python uses indentation to group code. Use descriptive names and f-strings to create readable output.

language = "Python"
year = 2026
print(f"Learning {language} in {year}")

Conditions and loops

Use if for decisions and for to iterate over a range or collection.

for number in range(1, 6):
    if number % 2 == 0:
        print(f"{number} is even")

2. Functions and collections

Functions express one job

Keep functions short, pass the values they need, and return results instead of relying on hidden state.

def square(value):
    return value * value

print(square(5))

Collections model groups

Use lists for ordered values and dictionaries when values have meaningful keys.

scores = {"Ada": 95, "Lin": 88}
for name, score in scores.items():
    print(name, score)

3. Files, modules, and reliability

Use with to close files automatically, import only what you need, and handle expected failures with focused try/except blocks.

from pathlib import Path

path = Path("notes.txt")
path.write_text("Python training\n", encoding="utf-8")
print(path.read_text(encoding="utf-8"))

Reliable Python: validate external input, let unexpected errors remain visible while learning, and write a small test before changing important code.

Before you move on

  • I can write a function that returns a value.
  • I can choose between a list, dictionary, set, and tuple.
  • I can create and use a class.
  • I can read and write text files safely.
  • I can handle a known exception.
  • I can use a module without copying its code.