What would you like to learn?

Try PowerShell, networks, XSS, or Step 138

Browse the full curriculum →

Python Basics for Security: Loops, Files and Log Analysis

YOUR LEARNING PATH

Run your first script, control its flow with conditions and loops, and combine functions, files and exception handling. Use text and log-processing projects to bring those pieces together into programs you can explain and debug.

Who is this path for?

New Python learners and security students who want to build small tools rather than only run existing scripts

Before you begin

Prepare a Python environment and a code editor. Start at Step 41 for installation and keep practice files in a separate working directory.

What you will practice

  • Use data types and if, for and while to control program flow.
  • Combine functions, modules, file input/output and exception handling.
  • Use regular expressions and text processing in a log-analysis project.

STEP BY STEP

Your suggested lesson order

01

Set up Python and control program flow

02

Organize programs with functions and files

03

Apply text processing in small projects

Before you move on

Try empty files, malformed input and unexpected values as well as the sample input. Before moving on, explain what your program reads, how it transforms the data and what result it produces.

Check each lesson’s setup and completion criteria. If you already know a section, start with the lessons you need.