Python Programming
Objective: Learn Python fundamentals and apply them to real IT automation tasks.
Python is the most widely used scripting language in IT. It's used for automation, security tools, web development, data analysis, and AI/ML.
You already understand programming fundamentals from Bash. Now you're applying them in a language that scales to real-world applications. All scripts go to a python-phase branch in your course-notes/ repo.
-
Variables, data types, operators
-
Strings : concatenation, f-strings, slicing
-
Lists, dictionaries, tuples, and sets
-
Loops (for, while) and list comprehensions
-
Functions : parameters, return values, default arguments
-
Modules and imports : built-in libraries and pip for third-party
-
File I/O : reading and writing with open() and the with statement
-
JSON and CSV data : json module and csv module
-
subprocess : run system commands from Python
-
Error handling : try/except/finally
-
Basic OOP : classes, objects, methods. Understand it because you'll see it everywhere.
- 1
Write a Python script that reads /var/log/syslog, counts error-level entries, and prints a summary.
- 2
Write a Python script that pings a list of IP addresses (read from a file) and writes results (up/down, response time) to a CSV file.
- 3
Write a Python script that monitors a directory for new files. When one appears, log the filename, size, and timestamp to a JSON file.
- 4
Write a Python script that takes a directory path as an argument and generates a Markdown report of all files: name, size, last modified date, and permissions.
- 5
Create a branch called python-phase. Add all scripts to course-notes/phase-11-python/python-scripts/ with one meaningful commit per script. Open a PR. Merge to main.