To access material, start machines and answer questions login.
In the Python: Core Concepts room, we learned how to work with data types, strings, lists, dictionaries, operators, and loops. We can now store data, inspect it, iterate over it, and make decisions based on conditions. These are the building blocks. In this room, we will learn how to assemble those building blocks into real programs.
Consider the difference between knowing individual musical notes and being able to play a song. In Core Concepts, you learned the notes. In this room, you will play the song.
Specifically, we will cover four capabilities that separate a code snippet from a real script: functions for organizing and reusing logic, error handling for building resilience, file I/O for reading input and writing output, and libraries for leveraging code that others have already written. By the end, we will combine every concept from both rooms into a single, working Password Strength Checker: a tool that evaluates passwords against length requirements, character variety rules, and a common-passwords wordlist.
Learning Objectives
After completing this room, you will:
- Define and call functions with parameters, return values, and defaults
- Understand variable scope
- Handle runtime errors with
try/except - Read from and write to files using context managers (
with) - Import modules from the Python standard library
- Install third-party packages with
pip - Combine all concepts into a complete, security-relevant program
Prerequisites
It is best if you tackle this room after finishing:
Machine Access
You can follow along by starting the attached virtual machine (VM). Visual Studio Code (VS Code) should open automatically with a modern Python installation ready for you. All example scripts discussed in this room are saved in the /home/ubuntu/Building-Scripts/ directory. We strongly encourage you to run, modify, and experiment with every code snippet on the as you progress through the tasks.
Set up your virtual environment
Let's build real scripts!
Ready to learn Cyber Security?
The Python: Building Scripts room is only available for premium users. Signup now to access more than 500 free rooms and learn cyber security through a fun, interactive learning environment.
Already have an account? Log in