
Every journey into AI governance engineering begins with a working Python setup. Before you can build risk registers, privacy scanners or audit tools, you need to be sure that Python is installed correctly and that you can run a script from start to finish. In this opening lecture you will check your installation and run your very first program.
You will begin by opening a terminal or command prompt and asking Python for its version. Seeing a version number appear is the quickest proof that the installation works, and you will learn what to do if the command is not found, including the common differences between python and python3 on different operating systems.
Next you will open a code editor and create a new file with a clear name and the dot py ending. You will write a single line that uses the print function to display a message, save the file and run it from the terminal. You will read the output carefully and learn how to recognise the most common first errors, such as a typing mistake or a missing quotation mark.
You will also meet the idea that a program is a list of instructions that Python reads from top to bottom, which is a simple but powerful picture that you will rely on throughout the course.
Finally you will make a small change, run the script again and see the new result, which builds the habit of editing and testing in short cycles.
By the end of this lecture you will be able to check that Python is installed, create a script file and run your first program from the terminal.
A surprisingly common beginner problem is that a script is correct but Python cannot find it. The cause is usually that the terminal is looking in a different folder from the one where the file is saved. In this lecture you will learn to run scripts from the right folder so that this problem never slows you down.
You will begin with the idea of a current working directory. Every terminal session is located in one folder at a time, and commands are interpreted relative to that location. You will learn the commands to show where you are, to list the files in the folder and to move into another folder, using the versions for your operating system.
Next you will create a dedicated project folder for the course and save a script inside it. You will deliberately run the script from the wrong folder and read the error message that says the file cannot be found, so that you recognise it immediately in future. Then you will move into the correct folder and run it successfully.
You will also practise running a script using a path, both relative and absolute, which allows you to start it from anywhere. You will see why spaces in folder names need care and why simple, short folder names make life easier.
Finally you will organise your course files into a tidy structure, which prepares you for the larger projects later in the bootcamp.
By the end of this lecture you will be able to navigate folders in the terminal and run scripts from the correct location.
Text is everywhere in governance work, from policy names and risk descriptions to audit messages. In Python, text is written between quotation marks, and you can use either single or double quotes. In this lecture you will learn how to quote text correctly and when each style is useful.
You will begin by printing short pieces of text with single quotes and then with double quotes, and see that the output is identical. This shows you that the quotes are only markers that tell Python where the text starts and ends, and that they are not part of the text itself.
Next you will meet the situation that makes the choice matter. If your text contains an apostrophe, such as in a sentence about a company's policy, single quotes would end the text too early and cause a syntax error. You will see that error and read what Python tells you. You will fix it by wrapping the text in double quotes. In the same way, text that contains double quotation marks can be wrapped in single quotes.
You will learn about the escape character, the backslash, which lets you include a quote of the same type inside text, and you will compare it with simply choosing the other quote style. You will also try triple quotes for text that spans several lines.
You will practise by printing several governance-style sentences, such as policy titles and short statements, using the clearest quoting each time.
By the end of this lecture you will be able to write text with single, double and triple quotes and fix quote-related errors.
Programs often need to show several pieces of information together, such as a label and a value. In this lecture you will learn how to print several values on one line using the print function and the commas between them.
You will begin with a simple example that prints a piece of text and a number side by side. You will see that when you separate values with commas, print displays them one after another with a single space between them. This is much easier than joining everything into one long piece of text yourself.
Next you will explore what you can combine. You will print text with whole numbers and with decimals, and see that print converts them for display automatically. You will compare this with trying to join text and a number with the plus sign and read the error that results, which introduces the important idea that Python treats text and numbers as different kinds of values.
You will then use this to print small governance-style messages, such as the name of a risk next to its score or a dataset name next to the number of records. You will experiment with printing many values at once and with an empty print call that produces a blank line.
You will also look at how the order of values affects the result and practise reading output and matching it with the code that produced it.
By the end of this lecture you will be able to print several values of different types on one line and explain why commas are convenient.
By default, print puts a space between values and starts a new line at the end. For tidy reports and clear messages, you often want something different. In this lecture you will control spacing and line endings using the sep and end options.
You will begin by reviewing the default behaviour with a short example that prints three words. You will see the spaces between them and notice that the next print call begins on a new line. Then you will learn that both behaviours are settings, and that you can change them.
Next you will use the sep option to choose what appears between values. You will replace the space with a dash, a comma, a colon or even nothing at all, and see how this can build things like dates, file names or simple separated lists without extra work. You will learn that sep is a keyword argument, written with a name and an equals sign, and that it comes after the values you want to print.
Then you will use the end option to choose what appears at the end. You will replace the new line with a space or a symbol so that several print calls continue on the same line, which is useful for progress messages and compact output.
You will combine both options in one call and practise predicting the output before running the program.
By the end of this lecture you will be able to adjust separators and line endings to format printed output exactly as you want.
Sometimes a single print call needs to produce several lines or align text into columns. Python gives you special characters inside text for this. In this lecture you will add line breaks and tabs using escape sequences.
You will begin with the newline character, written as a backslash followed by the letter n. When Python meets it inside text, it moves to the start of a new line. You will print one piece of text that produces three lines and compare it with three separate print calls, and learn when each is clearer.
Next you will meet the tab character, written as a backslash followed by the letter t. It moves the output to the next tab stop, which gives you simple columns. You will print a small table of invented risk names and scores, and see how tabs line the values up, while also noticing that they do not align perfectly when the words have very different lengths. This is a first hint of why formatting tools, which you will meet shortly, are valuable.
You will also learn how to print a real backslash by doubling it, which matters when you work with Windows file paths, and you will meet raw strings, which treat backslashes literally.
You will practise by writing a short multi-line message, such as a mock audit header, using only escape sequences.
By the end of this lecture you will be able to use newline and tab characters, print backslashes and choose between several print calls and one multi-line string.
Python is also a powerful calculator, and the print function can display the results of calculations directly. In this lecture you will print calculated results and learn the basic arithmetic symbols.
You will begin with addition, subtraction, multiplication and division, written with the plus sign, the minus sign, the asterisk and the forward slash. You will place a calculation inside print and see the answer appear. You will notice that division returns a decimal result even when the numbers divide evenly.
Next you will learn about the order of operations. Python follows the same rules as mathematics, so multiplication and division happen before addition and subtraction, and you can use parentheses to control the order. You will compare an expression with and without parentheses and explain the difference in the answers.
You will combine calculations with text by printing a label followed by a calculated value, such as the number of records multiplied by a cost. You will see that the calculation is carried out first and the result is then displayed.
You will also discover how Python shows very large and very small numbers, and how decimal results can sometimes show small rounding effects, which you will learn to handle later in the course.
You will finish with a few practical examples from governance work, such as calculating a percentage of records that failed a check or the total number of items across several groups.
By the end of this lecture you will be able to print calculation results, use parentheses and understand the order of operations.
You have printed text and numbers separately and together, but combining them neatly can still feel clumsy. Python offers a better way: f-strings. In this lecture you will format output with f-strings, one of the most useful skills in everyday Python.
You will begin with the syntax. You place the letter f directly before the opening quotation mark, and then you can put variable names or expressions inside curly braces within the text. Python replaces each one with its value. You will compare a message built with commas and one built with an f-string and see how much easier the second is to read.
Next you will insert calculations directly inside the braces, such as multiplying two numbers or converting a value, and see the result appear in the sentence. You will learn that anything that produces a value can go inside the braces.
You will then control how values look. You will use format specifiers after a colon to set the number of decimal places, show a percentage, add thousands separators and align text with a width. You will build a small, neat table of invented risk names and scores, and see how the alignment options solve the problem you saw earlier with tabs.
You will practise writing a mock audit summary line that includes a name, a count and a percentage, formatted cleanly.
You will also see the common mistakes, such as forgetting the f or mismatching braces, and read the resulting messages.
By the end of this lecture you will be able to build clear, formatted messages using f-strings, including numeric format specifiers.
Programs need a way to remember information, and in Python that is the job of a variable. A variable is a name attached to a value, so that you can use it again later without typing the value out each time. In this lecture you will learn how to store values in variables.
You will begin with the simplest picture: a variable is a labelled box that holds something. You will create your first variable with the equals sign, for example giving a name to a number or a piece of text, and then print it. You will learn that the equals sign here means assign rather than equals in the mathematical sense, which is the first idea that often confuses beginners.
Next you will use variables in calculations. Instead of repeating a number in several places, you will store it once and refer to it by name, which makes code easier to read and far easier to change. You will see how changing the value in one place changes every result that depends on it.
You will also learn that Python reads from top to bottom, so a variable must be created before it is used, and you will read the NameError that appears when it is not.
You will practise with governance-flavoured examples, such as storing the name of a model, the number of records in a dataset and a risk threshold, and then printing a short summary using these variables.
By the end of this lecture you will be able to create variables, use them in expressions and print their values.
Choosing a good name for a variable might seem minor, but in real projects it makes the difference between code that others can understand and code that nobody dares to touch. In this lecture you will learn how to name variables well.
You will begin with the rules that Python enforces. A name may contain letters, digits and underscores, it cannot start with a digit, it cannot contain spaces or most symbols and it cannot be one of the reserved words that Python uses for itself. You will try breaking each rule on purpose and read the syntax errors, so that you recognise them later.
Next you will learn the conventions that experienced programmers follow. Names are written in lowercase with underscores between words, a style called snake case. They should describe what the value means, not how it is stored, so risk_score is better than x or number1. You will compare versions of the same short program written with poor names and with clear ones, and see how the clear one almost explains itself.
You will also learn that names are case sensitive, so score and Score are different variables, and why mixing them is a source of bugs. You will see why single letters are acceptable only in very short, obvious cases, and why you should avoid names that look alike or shadow built-in functions such as print.
You will rename variables in a small governance script to make it easier to read.
By the end of this lecture you will be able to follow Python's naming rules and choose names that make your code clear.
Variables are called variables because their values can vary. A program often needs to keep a running total, update a counter or replace an old value with a new one. In this lecture you will learn how to change and update variables.
You will begin with reassignment. You will create a variable, print it, give it a new value and print it again, and see that the old value is simply replaced. You will learn that the new value can even be of a different type, although doing that without a good reason can make code confusing.
Next you will update a variable using its own value, such as adding one to a counter or increasing a total by a number. You will write this in the long form first, with the variable on both sides of the equals sign, and read it carefully from right to left. Then you will meet the shorthand operators for adding, subtracting, multiplying and dividing in place, and see that they do the same job in less space.
You will trace a program by hand, writing down the value of each variable after every line. This is one of the best ways to understand what code does, and it is a technique that you will use whenever something behaves unexpectedly.
You will apply it to examples such as counting how many checks have been completed, adding up the cost of items and adjusting a risk score after a mitigation.
By the end of this lecture you will be able to reassign variables, use shorthand update operators and trace changes step by step.
Numbers come in more than one kind in Python, and the difference matters when you do calculations. In this lecture you will work with whole numbers and decimals, which Python calls integers and floating point numbers.
You will begin with integers, the whole numbers with no fractional part, such as the count of records or the number of risks in a register. You will see that Python can handle very large integers without any trouble. Then you will meet floats, numbers with a decimal point, such as a percentage or a score of seven point five.
Next you will explore how the two behave together. When you combine an integer and a float in a calculation, the result is a float. When you divide with the slash, you always get a float, even if the answer is a whole number. You will also use the double slash for floor division, which gives a whole-number result, and the percent sign for the remainder, and see where each is useful, for example when splitting items into equal groups.
You will learn about a surprising feature of floats. Because of how computers store decimals, some results show tiny errors, such as zero point one plus zero point two giving a result slightly different from zero point three. You will understand why this happens, how to round results with the round function and why money calculations need extra care.
You will practise with examples such as average scores and percentages of failed checks.
By the end of this lecture you will be able to choose between integers and floats, use division operators and round results sensibly.
Not everything in a program is a number. Names, messages and descriptions are text, and Python needs to know the difference. In this lecture you will work with text values, called strings, and learn how to check the type of any value.
You will begin by creating strings and storing them in variables. You will see that text that looks like a number, such as the digits one and two in quotation marks, is still text and behaves differently from the number twelve. You will try adding two strings with the plus sign and see them joined together, and compare that with adding two numbers.
Next you will meet the type function. You will call it on integers, floats and strings and read the answers, which are int, float and str. You will use it to investigate surprising behaviour, such as why combining a number and a piece of text with a plus sign produces a TypeError, and read the message so that it becomes familiar.
You will learn that checking types is one of the quickest ways to debug a problem. When a calculation produces an odd result or an error, asking what type a value really has often reveals the cause. You will also see the type of other values, such as true and false and the special value None.
You will practise with a small script that stores a model name, a version number and a threshold, and prints each with its type.
By the end of this lecture you will be able to create strings, tell them apart from numbers and use type to inspect values.
You already know the four basic arithmetic operators. Python has a few more that become very useful in real programs, especially when you need to split things into groups, check whether a number is even or work with powers. In this lecture you will learn more arithmetic operators.
You will begin with floor division, written with two slashes. It divides and then rounds down to a whole number, so that seven divided by two gives three instead of three point five. You will use it to work out how many full groups fit into a total, such as how many full pages of results are needed for a number of items.
Next you will meet the modulo operator, written with a percent sign, which gives the remainder after division. You will use it to check whether a number is even or odd, to see whether a count is divisible by another number and to find what is left over after splitting items into groups. This operator appears everywhere in programming, so you will practise it with several examples.
You will then use the exponent operator, written with two asterisks, to raise a number to a power, which is useful for squares and for compound growth. You will review the order of operations once more to see where each operator fits, and use parentheses to make your intent clear.
You will finish with combined examples, such as calculating a score squared or finding the remainder of a record count.
By the end of this lecture you will be able to use floor division, modulo and exponent operators confidently.
Data rarely arrives in the type you need. A number read from a file is text, and a score you want to include in a sentence is a number. In this lecture you will learn to convert between types using int, float and str.
You will begin by demonstrating the problem. You will take text that looks like a number, try to do arithmetic with it and read the TypeError. You will then solve it by wrapping the text in int or float, and see that the calculation now works.
Next you will learn what each conversion does. The int function turns a float into a whole number by cutting off the decimal part, and it can also convert text that contains only digits. The float function turns integers and numeric text into decimals. The str function turns any value into text, which is helpful when joining a number into a message.
You will try conversions that fail, such as turning words into numbers, and read the ValueError. You will understand that Python cannot guess your intent, and that you should expect this kind of error whenever you convert data from outside the program. You will see the difference between converting and rounding, and why truncation can surprise you with negative numbers.
You will practise with a small script that reads values written as text, converts them to numbers, calculates a percentage and prints a formatted result.
By the end of this lecture you will be able to convert values between int, float and str and recognise conversion errors.
Text appears in nearly every governance task, from policy names to log messages, and Python offers many tools for working with it. In this lecture you will work with strings and learn their most useful operations.
You will begin with the length of a string, found with len, and with indexing, which lets you pick out a single character by its position. You will learn that positions start at zero and that negative numbers count from the end. You will then use slicing to take a section of text, with a start and a stop position, and see how it can extract a prefix, a suffix or a middle part.
Next you will meet string methods, which are built-in actions that you call with a dot. You will change case with upper, lower and title, remove surrounding spaces with strip, replace parts of the text with replace and check beginnings and endings with startswith and endswith. You will find text inside text with find and the in operator, and count occurrences with count.
You will learn that strings are immutable, which means that methods return new strings rather than changing the original, so you need to store the result. You will join strings with plus and repeat them with an asterisk.
You will practise with clean-up tasks, such as tidying a messy risk title, extracting an identifier from a code and checking that a file name ends with the right extension.
By the end of this lecture you will be able to index and slice strings and apply common string methods to clean and inspect text.
Governance is full of yes-or-no questions. Is the score above the threshold? Is the field filled in? Has the check passed? Python represents answers like these with the values True and False, called booleans. In this lecture you will learn booleans and comparisons.
You will begin by creating boolean values directly and seeing their type. Then you will produce them with comparison operators. You will compare numbers with equal to, which is written with two equals signs, not equal to, greater than, less than, greater than or equal to and less than or equal to. You will emphasise the difference between a single equals sign, which assigns, and a double equals sign, which compares, since mixing them up is a very common early mistake.
Next you will compare strings, and see that comparison is case sensitive, so that the words High and high are different. You will practise tidying text with lower before comparing. You will also compare values of different types and see what happens.
You will store the result of a comparison in a variable, such as a flag that says whether a record passed a check, and print it. You will learn that every value in Python has a truthiness, so that empty text and zero behave like False, which prepares you for the decisions you will write in the next section.
You will test several comparisons by predicting the answer before running them.
By the end of this lecture you will be able to create booleans, use all the comparison operators and avoid confusing assignment with comparison.
Real decisions often depend on more than one condition. A record might be acceptable only if it has a name and a valid age, or a risk might need attention if it is either high impact or high likelihood. In this lecture you will combine conditions with the logical operators and, or and not.
You will begin with and. It produces True only when both sides are True. You will build a small truth table by hand, and test it with examples such as checking that a score is both above a minimum and below a maximum. You will see that Python also allows a chained comparison, which reads very naturally for ranges.
Next you will use or. It produces True when at least one side is True. You will apply it to cases such as accepting either of two valid formats. Then you will use not, which flips a boolean, to express the opposite of a condition and to make code read more clearly.
You will learn how Python evaluates these operators in order, with not first, then and, then or, and why parentheses are the best way to make your meaning clear to both Python and other readers. You will also meet short-circuit evaluation, in which Python stops as soon as the answer is known.
You will practise by writing combined conditions for a governance scenario, such as deciding whether a dataset is ready for review, and testing them with different values.
By the end of this lecture you will be able to combine conditions with and, or and not and use parentheses to keep them clear.
Programs become useful when they can choose what to do. A governance tool must be able to say that if a risk score is high, then it needs attention. In this lecture you will write your first decision with the if statement.
You will begin with the structure. The word if is followed by a condition, a colon and then an indented block of code. If the condition is True, the indented block runs. If it is False, Python skips it. You will write a simple example that prints a warning when a score is above a threshold, and run it with values on both sides of the threshold.
Indentation is the central lesson. In Python, the spaces at the start of a line show which statements belong to the block. You will see what happens when the indentation is missing, producing an IndentationError, and when it is inconsistent. You will adopt the standard of four spaces and learn how your editor can help.
You will also see that code after the block, which is not indented, always runs, whatever the condition. You will use this to print a final message, and practise tracing which lines run for different inputs.
You will use comparison operators from the previous section to write conditions about numbers and text, and store the result of a condition in a variable before using it.
You will write small governance examples, such as flagging a dataset that has too few records and printing a notice only when a model version is missing.
By the end of this lecture you will be able to write if statements, understand indentation and predict which code runs.
An if statement handles the case where a condition is true, but often you also need to say what happens when it is not. Python provides the else clause for this. In this lecture you will take the other path with else.
You will begin by extending your threshold example. When the score is above the limit, the program prints a message that the item needs review. Using else, you will add a second block that runs in all other cases, for example printing that the item is acceptable. You will see that exactly one of the two blocks always runs, never both and never neither.
You will learn the syntax carefully. The else keyword lines up with its matching if, is followed by a colon and has its own indented block. You will read the SyntaxError that appears if you place a condition after else, which helps you remember that else has no condition because it covers everything else.
Next you will practise with several two-way decisions, such as whether a dataset passes a size check, whether a name field is filled in and whether a number is even or odd using the remainder operator. You will test each one with values on both sides of the boundary, which is a good habit for any decision logic.
You will also store the outcome in a variable inside each branch and print it afterwards, to show how decisions can set values for later use.
By the end of this lecture you will be able to write two-way decisions with if and else and test both outcomes.
Many decisions have more than two outcomes. A risk may be low, medium or high, and each needs different handling. In this lecture you will choose among many options with elif.
You will begin with the problem. Two branches are not enough to describe three or four levels, and nesting several if statements gets messy. The elif keyword, short for else if, lets you add further conditions in a single chain. You will write a chain that turns a numeric score into a label of low, medium or high.
You will learn how Python evaluates the chain. It checks each condition from the top and runs the first block whose condition is True, then skips the rest. This means that the order matters. You will see what goes wrong when you put the broadest condition first and fix it by ordering the tests from most specific to least, or by using ranges carefully.
You will add a final else as a catch-all for values that match nothing else, and discuss when it is useful, for example to detect invalid input. You will test boundary values, such as a score exactly equal to a limit, to make sure that the comparison operators are right, which is a common source of off-by-one mistakes.
You will practise with grading scores, assigning review levels to risks and choosing a message for each status code.
By the end of this lecture you will be able to write if, elif and else chains, order conditions correctly and test their boundaries.
Real-world rules usually involve several facts at once. A dataset may be ready only when it has enough records and a documented owner, and a model may require extra review if it is high risk or affects many people. In this lecture you will combine conditions in a decision.
You will begin by bringing together the logical operators from the previous section and the if statements you have just written. You will write conditions that use and, or and not directly inside an if, and see that this is often clearer than nesting.
Next you will explore how to make a long condition readable. You will use parentheses to group parts, break a long line sensibly and give names to intermediate results by storing them in variables before the if statement. A variable such as has_owner or is_large_enough turns a complicated test into a sentence that anyone can read, which is a key habit in governance code that others will review.
You will study how the order of evaluation affects results, and the use of short-circuiting to avoid errors, for example checking that a value exists before comparing it.
You will test your conditions systematically. For a rule with two inputs, you will try every combination of true and false and record the result in a small table, to be sure that the logic matches the policy you intended.
By the end of this lecture you will be able to write decisions based on several facts, keep them readable and test every combination.
Sometimes one decision leads to another. You first check whether a record exists, and only then check whether its values are valid. Python lets you place an if statement inside another, which is called nesting. In this lecture you will write decisions inside decisions.
You will begin with a simple example in which an outer if checks whether a dataset has been provided, and an inner if checks whether it has enough records. You will see how the indentation shows which block belongs to which condition, with each level moving four spaces further in.
Next you will trace the flow. For several combinations of inputs, you will follow the path that Python takes, noting which messages appear. You will discover that an else attached to the inner if is different from an else attached to the outer one, and why the alignment is vital.
You will then compare nesting with the alternative of combining conditions with and. In many cases, a single combined condition is flatter and easier to read, but nesting is better when the inner check depends on the outer one being true, or when you need different messages for each failure. You will learn the idea of guard clauses and early exits, which avoid deep nesting by handling problems first.
You will practise by writing a small approval flow that checks several requirements in order and reports the first one that fails.
By the end of this lecture you will be able to write nested decisions, trace their flow and decide when to flatten them.
Computers are excellent at repeating work, and loops are how you ask for it. A while loop keeps running a block of code for as long as a condition remains true. In this lecture you will repeat work with a while loop.
You will begin with the structure. The word while is followed by a condition, a colon and an indented block. Python checks the condition, runs the block if it is true and then returns to check the condition again. You will write a simple counter that prints the numbers from one to five, and follow each step of the loop by hand.
Next you will learn the three parts of a well-behaved loop: a starting value, a condition and a change that moves toward ending. You will see what happens when the change is missing, producing an infinite loop that never ends, and learn how to stop a runaway program with the keyboard shortcut for your system.
You will use while loops for tasks that suit them, where you do not know in advance how many times you will repeat. Examples include adding up values until a total passes a limit, asking for input until it is valid and reducing a number until it reaches zero.
You will practise tracing variables through each pass, and writing the condition so that the loop stops at the right moment, being careful about the difference between less than and less than or equal to.
By the end of this lecture you will be able to write while loops, avoid infinite loops and choose the right condition.
Sometimes a loop should end before its condition becomes false, because you have found what you were looking for or because something has gone wrong. The break statement does exactly that. In this lecture you will stop a loop early with break.
You will begin with a loop that deliberately never ends on its own, written as while True. This pattern looks alarming at first, but it is common and useful when the stopping rule is easier to express inside the loop. You will place an if statement inside it that calls break when a condition is met, and see the loop end immediately.
Next you will use break to search. You will loop through a series of values until you find the first one that meets a requirement, such as the first score above a threshold, and stop there instead of wasting effort on the rest. You will compare this with a loop that always runs to the end.
You will see what happens after the break. Python continues with the first line after the loop, and you will print a message there to show where the program resumes. You will also meet the else clause on a loop, which runs only if the loop finished without a break, and see how it can report that nothing was found.
You will practise with examples such as stopping when a running total passes a budget, limiting the number of attempts in a retry loop and exiting when a keyword is entered.
By the end of this lecture you will be able to use break, write while True loops safely and handle the case where nothing is found.
When you know how many times you want to repeat something, or you want to go through a series of numbers, the for loop with range is the tool to use. In this lecture you will count with for and range.
You will begin with the structure. The word for is followed by a variable name, the word in, a sequence and a colon, and then an indented block. In each pass, the variable takes the next value from the sequence. You will use range to produce a sequence of numbers and print them.
Next you will explore the three forms of range. With one number, it counts from zero up to but not including that number. With two, you choose the start. With three, you also choose the step, which allows you to count by twos, go backwards or skip values. You will learn why the end value is excluded and how to adjust for it, since this causes many off-by-one errors.
You will use the loop variable in calculations, such as building a multiplication table, adding up the numbers from one to ten or printing a countdown. You will compare the for loop with the while loop, noticing that the for loop manages the counting for you, which makes it shorter and safer.
You will also practise using an underscore as the variable name when you do not need its value, and build a loop that simply repeats an action a set number of times.
By the end of this lecture you will be able to write for loops with range, control start, stop and step and choose between for and while.
Strings are sequences, which means that a for loop can go through them one character at a time. This is a handy way to inspect, count and check text. In this lecture you will loop over the characters of a string.
You will begin with a short word and a for loop that prints each character on its own line. You will see that the loop variable takes each character in order, just as it took each number from a range. This shows a general idea in Python: a for loop works with anything that can be taken one piece at a time.
Next you will use loops to examine text. You will count how many times a given letter appears, count the vowels in a sentence and build a new string by adding characters one at a time. You will use if statements inside the loop to decide what to do with each character, combining what you have learned about decisions and repetition.
You will meet useful string methods that fit naturally here, such as isdigit, isalpha and isupper, and use them to classify characters. You will then apply this idea to a governance-style task, such as counting the digits in a piece of text to see whether it might contain a number that should not be there.
You will also compare looping over characters with using the count method and the in operator, and discuss when a simple method is better than a loop.
You will trace a loop by hand to confirm your understanding.
By the end of this lecture you will be able to loop over text, count and classify characters and build new strings.
Two more loop tools complete the basics: continue, which skips the rest of the current pass, and the running total, which gathers a result as the loop proceeds. In this lecture you will skip ahead with continue and calculate totals.
You will begin with continue. When Python meets this statement inside a loop, it jumps straight back to the start of the next pass, ignoring the remaining lines in the block. You will use it to skip values that you do not want to process, such as negative numbers or blank entries, and compare it with wrapping the rest of the block in an if statement.
Next you will build running totals. You will create a variable before the loop, usually starting at zero, and update it inside the loop with the shorthand operator. After the loop ends, the variable holds the total. You will use the pattern to add up numbers, count how many values met a condition and calculate an average by dividing the total by the count, taking care to avoid dividing by zero when no values were counted.
You will combine continue and totals in one example, adding only the valid scores from a list of values and reporting how many were skipped. You will also track the largest and smallest values seen so far.
You will practise by tracing the variables by hand through several passes, which is the best way to see why the pattern works.
By the end of this lecture you will be able to use continue, accumulate totals and counts and calculate averages safely.
So far, each variable has held one value. Real data comes in groups, such as a series of scores or a set of risk names, and the list is Python's most common way to hold them. In this lecture you will create your first list.
You will begin by writing a list with square brackets and commas, such as a collection of dataset names. You will print it and see how Python displays it, and check its length with len. You will learn that a list can hold values of any type, and even mixed types, although a list of similar items is usually clearer.
Next you will access items by position. You will use indexing, remembering that the first item is at position zero and that negative numbers count from the end, and slicing to take part of a list. You will read the IndexError that appears when you ask for a position that does not exist, and learn to check the length first.
You will test membership with the in operator, to ask whether a value is present, and combine this with if statements. You will also create an empty list and see why it is a useful starting point.
You will practise by creating lists of invented governance items, such as risk categories, policy names and scores, and extracting information from them. You will compare a list with a set of separate variables, and see how much more flexible a list is when the number of items changes.
By the end of this lecture you will be able to create lists, access items by index and slice and test for membership.
Lists are useful because they can change. You can add new items, remove old ones and rearrange them. In this lecture you will learn how to change a list.
You will begin by replacing an item by assigning to its position. Then you will add items with append, which places a new item at the end, and with insert, which places it at a chosen position. You will extend a list with several items at once using extend, and compare it with append, noticing the difference when you add another list.
Next you will remove items. You will use remove to delete the first item with a given value, pop to remove and return an item by position, with the end as the default, and del to delete by index or slice. You will see the errors that occur when you remove something that is not there, and use the in operator to check first.
You will learn about sorting. You will arrange a list in order with sort, which changes the list itself, and sorted, which returns a new one, and reverse the order with the reverse argument. You will also count items and find positions with count and index.
An important lesson is that lists are mutable, and that two variables can refer to the same list. You will see how a change through one name appears through the other, and how to make an independent copy.
You will practise by managing a changing list of invented risks.
By the end of this lecture you will be able to add, remove, replace and sort list items and copy lists correctly.
A list becomes powerful when you can process every item in it. A for loop does this naturally. In this lecture you will loop over a list.
You will begin with the simplest form. The loop variable takes each item in turn, and you write the instructions for one item in the block. You will print every item, then calculate with them, for example totalling a list of scores or formatting each name in a message. You will compare this with looping over positions using range and len, and see why looping directly over the items is simpler and less error prone.
Next you will meet enumerate, which gives you both the position and the item. You will use it to number a list starting from one, a very common need for reports. You will also use zip to loop over two lists together, such as names and scores, and learn what happens when they have different lengths.
You will combine loops with decisions. You will build a new list from an old one by appending only the items that meet a condition, and you will count, total and find the largest value. You will see the compact form known as a list comprehension, as a preview, and compare it with the longer loop.
An important warning is that you should not add or remove items from a list while looping over it, because this leads to skipped items, and you will see an example of the problem and a safe alternative.
By the end of this lecture you will be able to loop over lists with for, enumerate and zip and build new lists from existing ones.
Sometimes you have a group of values that should never change, such as the days of the week, a pair of coordinates or the fixed fields of a record. For these cases, Python offers the tuple. In this lecture you will learn tuples, the lists that stay fixed.
You will begin by creating a tuple with parentheses and commas and printing it. You will see that you can index, slice, loop over and measure it exactly as you can with a list. Then you will try to change an item and read the TypeError, which shows that tuples are immutable.
Next you will explore why that restriction is useful. A tuple tells readers that the values belong together and are not meant to change. It protects against accidental modification, and because tuples are immutable, they can be used in places where lists cannot, such as the keys of dictionaries and the items of sets.
You will learn the quirk of a tuple with one item, which needs a trailing comma, and the idea of unpacking, where a tuple's values are assigned to several variables at once. You will use unpacking to swap two variables and to receive several results, which prepares you for functions that return more than one value.
You will convert between lists and tuples with list and tuple, to modify a fixed collection when you must.
You will practise with examples such as a risk record made of a name, a likelihood and an impact.
By the end of this lecture you will be able to create and unpack tuples and choose between a tuple and a list.
Sometimes the order of items does not matter, but uniqueness does. You want to know which different departments appear in a dataset, or whether two lists share anything. Python's set is designed for this. In this lecture you will learn sets, collections without duplicates.
You will begin by creating a set with curly braces, and by converting a list with the set function. You will watch duplicates disappear, and notice that the items are not kept in any particular order, which means that you cannot index a set. You will check its length and test membership with in, which is very fast.
Next you will add and remove items with add, remove and discard, and see the difference between the last two when the item is missing. You will create an empty set with the set function and learn why empty curly braces create a dictionary instead.
The most useful part is set operations. You will find the union, which combines two sets, the intersection, which finds items in both, the difference, which finds items in one but not the other, and the symmetric difference. You will use them to compare lists, such as which required fields are missing from a record, and which approved tools appear in a list of tools in use.
You will use sets to remove duplicates from a list and to count the number of distinct values.
You will practise with small examples drawn from governance tasks.
By the end of this lecture you will be able to create sets, remove duplicates and use set operations to compare collections.
A list finds things by position, but often you want to find them by name. You want the score for a particular risk, or the owner of a particular dataset. For this, Python provides the dictionary. In this lecture you will look up values by key.
You will begin by creating a dictionary with curly braces and key and value pairs separated by colons. You will print it and see its structure. You will use a key in square brackets to retrieve its value, and see the KeyError that appears when the key does not exist.
Next you will learn the safer ways to look things up. The get method returns None, or a default that you choose, when a key is missing, and the in operator tests whether a key is present. You will use them to handle optional information gracefully.
You will explore the rules. Keys must be unique, and they must be immutable types such as strings, numbers and tuples. Values can be anything, including lists and other dictionaries, which allows you to describe real records. You will build a dictionary that describes a risk, with a name, an owner, a likelihood and an impact, and a list of such dictionaries that forms a simple register.
You will see how dictionaries relate to JSON, the data format that you will meet later, and why they are the natural way to represent structured records in governance tools.
You will practise with exercises such as looking up values and counting how many keys a record has.
By the end of this lecture you will be able to create dictionaries, look up values safely and represent records.
Dictionaries are not fixed. You can add new information, change existing values and go through everything they contain. In this lecture you will update and loop over a dictionary.
You will begin with changing and adding entries. Assigning to a key that exists replaces its value, and assigning to a key that does not exist adds a new pair. You will use the update method to merge another dictionary and the setdefault method to add a key only when it is missing. You will remove entries with pop and del, and clear a dictionary completely.
Next you will loop. A plain for loop gives you the keys. You will also use the keys, values and items methods to loop over keys, values or both at once, unpacking each pair into two variables. You will print a tidy summary of a record, and calculate totals and averages from the values.
You will use dictionaries as counters, a very common pattern. You will loop over a list of items, and for each one, add one to its count in a dictionary, using get with a default of zero. You will see how this builds a table of how often each value appears, and compare it with the Counter you will meet later.
You will learn to build a dictionary from two lists with zip, and to sort the items by value to find the highest. You will also see the warning about changing the size of a dictionary while looping over it.
By the end of this lecture you will be able to add, change and remove entries, loop in several ways and count with dictionaries.
As programs grow, you will find yourself writing the same instructions in several places. A function lets you write the instructions once, give them a name and use them whenever you like. In this lecture you will write your first function.
You will begin with the syntax. The word def is followed by a name, a pair of parentheses and a colon, and then an indented block, called the body. You will write a simple function that prints a short message, and learn that nothing happens when you define it. The body runs only when you call the function by writing its name with parentheses.
You will call the function several times and see how reuse saves effort. You will then change the body in one place and see the change apply everywhere the function is called, which is one of the main benefits of functions. You will learn the naming conventions, which are the same as for variables, with lowercase words joined by underscores and a verb that describes what the function does.
You will see the order that matters. A function must be defined before it is called, and you will read the NameError that results when it is not. You will also add a docstring, a short description in triple quotes at the start of the body, and see how it documents the purpose of the function.
You will practise by writing functions that print a banner, a separator line and a short report header.
By the end of this lecture you will be able to define and call functions and explain why they make code easier to maintain.
A function that does exactly the same thing every time is of limited use. Giving a function inputs allows it to work with different data on each call. In this lecture you will give functions inputs, called parameters.
You will begin by adding a parameter to the parentheses in the definition, such as a name. Inside the body, the parameter works like a variable. When you call the function, you supply a value, called an argument, which becomes the value of the parameter for that call. You will call the same function with several different arguments and compare the results.
You will learn the vocabulary of parameters and arguments and why it matters. A parameter is the name in the definition, and an argument is the value in the call. You will then add several parameters, separated by commas, and see that arguments are matched by position. You will read the TypeError that appears when you pass too few or too many.
You will also use keyword arguments, where you name the parameter in the call, which makes calls easier to read and allows any order. You will compare the two styles with a function that takes three values.
You will discuss the idea of scope in a simple way, noticing that parameters exist only inside the function.
You will practise by writing functions that format a risk summary from a name and a score and that print a message with a chosen level of detail.
By the end of this lecture you will be able to write functions with parameters and call them with positional and keyword arguments.
So far, your functions have printed results on the screen. But printing is not the same as giving something back to the code that called the function. The return statement sends a value back. In this lecture you will get results back with return.
You will begin with a function that calculates a value, such as a risk score, and prints it. You will then change it to return the value instead, and store the result in a variable at the call site. You will see that the returned value can be used in further calculations, in conditions and as an argument to other functions, which is not possible when a function only prints.
You will learn that return ends the function immediately. Any lines after it in the same path do not run, and you will use this to write functions that leave early when a condition is met. You will see what a function returns when it has no return statement, which is the special value None, and why this explains some confusing results when you try to use the output of a function that only prints.
You will compare printing and returning in a table, and form the habit of returning values and letting the caller decide whether to show them.
You will practise by writing small functions that calculate an average, decide whether a score passes a threshold and return a label for a score, and then combine them.
By the end of this lecture you will be able to use return to give results back, use them in other code and explain the difference from print.
When a parameter usually has the same value, forcing every caller to provide it is tedious. Python lets you give a parameter a default value, which is used when the caller does not supply one. In this lecture you will use default parameter values.
You will begin with a function that formats a message with a name and a greeting, and add a default for the greeting by writing an equals sign and a value in the definition. You will call the function with and without the second argument, and see that supplying a value overrides the default.
You will learn the rule about order. Parameters with defaults must come after parameters without them, and you will see the SyntaxError that results from breaking it. You will combine defaults with keyword arguments so that callers can change one option and leave the others alone, which makes functions with many settings pleasant to use.
You will practise with governance examples, such as a function that checks a score against a threshold with a default threshold, or one that formats a record with an optional prefix. You will see how defaults make the common case simple while keeping flexibility.
You will also meet an important trap. A default value is created once, when the function is defined, so a mutable default such as an empty list is shared between calls and can accumulate data in surprising ways. You will see the problem and learn the standard fix, using None as the default and creating the list inside the function.
By the end of this lecture you will be able to set default values, combine them with keywords and avoid the mutable default trap.
A function can only return one thing, but that thing can be a group. Python makes it easy to return several values at once by separating them with commas. In this lecture you will return multiple values from a function.
You will begin with a function that analyses a list of scores and needs to report the smallest value, the largest value and the average. You will write return followed by three values separated by commas, and learn that Python packs them into a tuple, which you met earlier.
Next you will receive them. You will assign the result to a single variable and index into it, and then use unpacking to assign to three variables in one line. You will see the ValueError that occurs when the number of variables does not match the number of values, and read it carefully.
You will compare tuples with returning a dictionary. A dictionary gives each value a name, which makes the call site self-explanatory and allows you to add new fields later without breaking existing code, while a tuple is shorter and suitable for two or three obvious values. You will write both versions and discuss when each is better.
You will practise with governance examples, such as a function that checks a record and returns whether it passed together with a list of reasons, and one that summarises a dataset by returning a count, a total and an average.
You will also use returned values in a decision and a formatted message.
By the end of this lecture you will be able to return several values, unpack them and choose between a tuple and a dictionary.
Variables disappear when a program ends. To keep information, such as a log, a report or a list of results, you need to save it to a file. In this lecture you will write your first text file with Python.
You will begin with the open function. It takes the name of a file and a mode, and in write mode, written as w, it creates a new file or replaces an existing one. You will open a file, call the write method with a line of text and close it with the close method, and then find the file in your folder and open it in an editor to confirm that Python created it.
You will learn that write does not add a line break for you, so you must include the newline character yourself, and you will write several lines by calling write more than once. You will see the importance of closing the file, which makes sure that everything is saved, and what can go wrong if you forget.
You will also learn a serious warning. Write mode erases the previous contents of an existing file without asking, so you should choose file names carefully and use a practice folder. You will see this happen on purpose with a throwaway file.
You will write a list of items to a file with a loop, and use f-strings to build each line. You will practise by writing a short mock audit log, with a title and several entries.
By the end of this lecture you will be able to create text files, write several lines and understand what write mode does to existing files.
Remembering to close every file is easy to forget, and a program that crashes before closing a file can leave it incomplete. Python has a cleaner way. In this lecture you will close files safely with the with statement.
You will begin by recalling the manual approach, with open, write and close, and imagining what happens if an error occurs between them. The close call might never run, and data might not be saved properly.
Next you will rewrite the same code with the with statement. You write with, then the open call, then the word as and a name for the file, followed by a colon and an indented block. Inside the block, you use the file as before. When the block finishes, whether normally or because of an error, Python closes the file automatically. You will print a check on the file object after the block to confirm that it is closed.
You will see that this pattern is considered standard practice, and you will use it for every file from now on. You will also learn how to open more than one file in a single with statement, for example reading from one and writing to another.
You will practise by converting the earlier examples, writing a log file with a loop, and by making a deliberate error inside the block to see that the file is still closed and the data written so far is kept.
By the end of this lecture you will be able to use with to open files safely and explain why it is better than closing by hand.
Once information is saved in a file, you need to be able to read it back. The simplest approach is to read the whole file at once. In this lecture you will read a whole file into a single string.
You will begin with the file that you wrote in earlier lectures. You will open it in read mode, written as r, which is also the default, inside a with statement and call the read method. The entire contents arrive as one string, which you will store in a variable and print. You will notice the newline characters in the text and see how print displays them as real line breaks.
You will then work with what you have read. You will use string methods that you already know, such as counting characters, converting to uppercase, searching for a word and splitting the text into a list of lines with splitlines or split. This shows how file reading connects to everything you learned about strings and lists.
You will see what happens when you try to write to a file opened for reading, and learn that the mode controls what you are allowed to do. You will also try reading a file twice and discover that the second read returns an empty string, because the position in the file is already at the end, which introduces the idea of a file position.
You will discuss when reading everything at once is a good idea and when a very large file might make it impractical.
By the end of this lecture you will be able to read an entire file into a string and process the text.
Reading everything at once is simple, but often you want to deal with one line at a time, such as processing each record in a log. In this lecture you will read a file line by line.
You will begin by seeing that a file object can be used directly in a for loop. In each pass, the loop variable holds the next line, so you can print it, test it or count it. You will print a numbered list of the lines of a practice file using enumerate.
You will notice that every line ends with a newline character, which produces blank lines when you print it. You will learn to remove it with the strip method, a small habit that you will use constantly when working with text files. You will also skip empty lines and lines that begin with a comment symbol.
Next you will compare approaches. The readline method reads a single line each time it is called, and readlines returns a list of all the lines. Looping directly over the file is memory efficient because it handles one line at a time, while a list lets you use indexes and look at the file more than once. You will discuss which to choose.
You will practise with tasks drawn from governance work. You will search a log for lines that contain a keyword such as error, count how many there are and collect the matching lines into a list.
By the end of this lecture you will be able to loop over a file, clean up line endings and filter lines using conditions.
Write mode replaces everything in a file, which is not what you want for a log that grows over time. Append mode adds new text to the end and leaves the existing content untouched. In this lecture you will add to a file with append mode.
You will begin by creating a file with a couple of lines, then opening it again in append mode, written as a, and writing more lines. You will read the file back and confirm that the old lines are still there, followed by the new ones. You will compare this with write mode on a copy of the file to make the difference unforgettable.
You will see that append mode also creates the file if it does not exist, which makes it convenient for log files that should start automatically. You will learn the importance of including a newline character at the end of each entry so that the next one begins on its own line.
You will add useful information to each entry, such as the date and time, using the datetime module in a simple way, so that a log shows when each event happened. You will build a small function that appends a message to a log file, and call it several times from a program.
You will put the modes together in a short table for reference, covering read, write, append and the variants for text and binary files, and discuss which to choose for common tasks.
By the end of this lecture you will be able to append safely to files, write timestamped entries and choose the right file mode.
Files go missing. A name is mistyped, a folder is moved or a file has not been created yet. By default, Python stops with an error when this happens, but a robust program expects it and responds sensibly. In this lecture you will handle missing files with try and except.
You will begin by deliberately opening a file that does not exist and reading the FileNotFoundError that appears. Looking at the traceback carefully will help you understand which line failed and why, and it will make the error message familiar.
Next you will wrap the risky code in a try block and add an except block that names the error. When the file is missing, the program no longer crashes. Instead, it prints a friendly message and continues. You will follow the flow of control, seeing that the rest of the try block is skipped when an error occurs, and that the code after the whole structure runs normally.
You will see why it is better to catch a specific error than to catch everything. A broad handler can hide mistakes that you did not expect, such as a typing error in your own code. You will add an else block, which runs only if nothing went wrong, and a finally block, which always runs.
You will practise by asking for a file name, trying to read it and creating a default file when it is missing. You will also check for a file's existence beforehand using pathlib and discuss when each approach is appropriate.
By the end of this lecture you will be able to handle missing files, read tracebacks and write programs that fail gracefully.
Comma separated values, or CSV, is one of the most common formats for tables of data. Spreadsheets and exports from many systems use it, and Python's csv module makes it simple to write. In this lecture you will write CSV files.
You will begin by looking at what a CSV file is: plain text in which each line is a row and commas separate the columns. You will see why writing this by hand with string joining can go wrong, especially when a value contains a comma or a quotation mark, and why a dedicated module is the better choice.
Next you will import the csv module and open a file in write mode using the with statement and the argument newline set to an empty string, which prevents blank lines between rows on some systems. You will create a writer object with csv.writer and use writerow to add a header row and then several data rows, such as invented risk names, owners and scores.
You will discover writerows, which writes a list of rows in one call, and use it with a list of lists. You will then meet DictWriter, which writes rows from dictionaries using a list of field names, and see how it matches the way you already represent records.
Finally you will open the result in a text editor and in a spreadsheet program to check that it looks right, and practise by saving a small risk register.
By the end of this lecture you will be able to write CSV files with writer and DictWriter and check the result.
Once data is stored in a CSV file, you will want to read it back and work with it. The csv module can turn each row into a dictionary, which is both convenient and readable. In this lecture you will read CSV files into dictionaries.
You will begin by opening the file you wrote earlier and creating a csv.reader, looping over it and printing each row. You will see that every row arrives as a list of strings, and that you have to remember which position holds which column. You will also notice that numbers arrive as text.
Next you will use csv.DictReader, which reads the header row and then gives you each following row as a dictionary keyed by the column names. Instead of remembering that the score is in position two, you write row with the key score. You will compare the two styles and see why dictionaries make code easier to read and safer when columns are reordered.
You will convert values to the right types, turning score text into integers or floats before comparing or adding them. You will filter rows with an if statement, calculate totals and averages and collect matching rows into a list.
You will handle problems carefully, such as a missing column or a value that cannot be converted, using what you know about try and except. You will report the row number of a problem so that the person fixing it knows where to look.
By the end of this lecture you will be able to read CSV files with DictReader, convert types and summarise the data.
CSV is good for tables, but many programs exchange more complex, nested information, such as a record that contains a list of items. JSON is the format designed for that, and it looks very much like Python dictionaries and lists. In this lecture you will save data as JSON.
You will begin by looking at a small piece of JSON and comparing it with a Python dictionary. You will notice the similarities of keys, values, lists and nested structures, and the small differences, such as true and false written in lowercase and null in place of None.
Next you will import the json module. You will use json.dumps to convert a Python dictionary into a JSON string, and add the indent option to produce readable output. You will then write data directly to a file with json.dump inside a with statement, and open the file in an editor to see how it looks.
You will read it back with json.load, and also use json.loads to turn a JSON string into Python data. You will confirm that the data you loaded is equal to the data that you saved. You will see what the module can and cannot save, for example that tuples become lists and that sets cannot be saved directly, and learn how to convert them first.
You will practise by saving a small risk register, with a list of dictionaries, to a JSON file and loading it again, and by handling a file that contains invalid JSON with a try and except block.
By the end of this lecture you will be able to save and load Python data as JSON and handle invalid input.
Real data is never perfect. A number might be missing, a field might contain words where a number is expected or a row might be incomplete. If your program assumes that all data is valid, one bad value can stop everything. In this lecture you will catch bad data with specific errors.
You will begin with the most common case: converting text to a number with int or float. You will try it with valid text, and with invalid text, and read the ValueError that results. You will then catch it with a try and except ValueError block, so that your program can skip the bad value, use a default or report the problem.
Next you will meet other common errors and what causes them. A KeyError happens when a dictionary key is missing, an IndexError when a list position does not exist, a TypeError when types do not fit and a ZeroDivisionError when you divide by zero. You will provoke each one and catch it with its specific name. You will catch more than one type in a single except by listing them in a tuple, or write separate except blocks for different responses.
You will build a loop that processes a list of mixed values, converting each, collecting the valid ones and counting the rejected ones, and print a clear summary. You will also raise your own error with the raise statement when a rule is broken, for example when a score is outside the allowed range.
By the end of this lecture you will be able to catch specific errors, process imperfect data safely and raise errors deliberately.
Python comes with a large collection of ready-made tools, called the standard library, and you use them by importing modules. The math module is a good first example. In this lecture you will import and use the math module.
You will begin with the import statement. Writing import math loads the module so that its contents are available under the name math. You will use dot notation to call its functions, such as math.sqrt for square roots, math.ceil to round up, math.floor to round down and math.pow for powers. You will compare floor and ceil on positive and negative numbers to see the difference.
Next you will use the constants in the module, such as pi and e, to calculate the area of a circle or to try a formula. You will learn the difference between the module's functions and the built-in functions, such as round and abs, and see that some tasks can be done either way.
You will explore a module with the dir and help functions. These let you see what a module contains and read its documentation without leaving Python, which is a valuable habit for learning any new library.
You will also see the NameError that appears when you forget to import, and the AttributeError when you misspell a function name.
You will practise with governance-style calculations, such as rounding a percentage up to the next whole number, or calculating the number of pages needed to show a number of results.
By the end of this lecture you will be able to import modules, call their functions with dot notation and explore what they offer.
Importing a whole module is not the only option. Sometimes you only need one or two functions, and writing the module name each time becomes tiring. In this lecture you will import specific names and use aliases.
You will begin with the from keyword. Writing from math import sqrt brings that one function into your program, so you can call it directly without the prefix. You will import several names in one statement, separated by commas, and see how the code becomes shorter.
Next you will learn about aliases with the as keyword. You will give a module a shorter name, such as import datetime as dt, a convention that is common in the Python community, and you will give a function a new name when the original is long or could clash with another name in your program. You will see what happens when two imports use the same name, and how the later one replaces the first, which can cause confusing bugs.
You will discuss the trade-offs. Importing everything with a star, as in from math import star, fills your program with names that you did not choose and makes it hard to see where each one came from, so it is generally avoided. Explicit imports make code clear and easy to maintain.
You will compare three versions of the same small program, one for each style, and decide which communicates best. You will also learn where imports belong, at the top of the file in a tidy group.
By the end of this lecture you will be able to use from imports and aliases and choose a clear import style.
Working with file paths as plain text is error prone. Different operating systems use different separators, and joining parts by hand quickly becomes messy. The pathlib module represents paths as objects with helpful methods. In this lecture you will work with paths using pathlib.
You will begin by creating a Path object and printing it. You will use the slash operator to join parts of a path, which works correctly on every operating system, and find the current directory and the home directory with Path.cwd and Path.home.
Next you will take a path apart. You will read its name, stem, suffix and parent, and use the parts property to see each component. You will ask questions with exists, is_file and is_dir, and use resolve to get an absolute path.
You will explore folders. You will list the contents with iterdir, find files by pattern with glob and search subfolders with rglob. You will build a short script that finds all the CSV files in a practice folder and prints their names and sizes. You will create folders with mkdir, using parents and exist_ok to avoid errors, and read and write small text files with read_text and write_text.
You will see how pathlib works naturally with the file handling you have already learned, since open accepts a Path object, and why it is preferred in modern code over joining strings by hand.
By the end of this lecture you will be able to build paths, take them apart, search folders and create directories with pathlib.
Counting how often things appear is one of the most common data tasks. You might count how many risks fall into each category or how many times a word appears in a log. You already know how to do it with a dictionary, but Python provides a faster tool called Counter. In this lecture you will use collections.Counter.
You will begin by writing the dictionary approach and noticing how many lines it takes, including the check for whether a key already exists. Then you will import Counter from the collections module and replace all of it with a single call on a list or a string, and compare the two versions.
You will explore what a Counter gives you. It behaves like a dictionary in which each key is an item and each value is its count. You will look up counts, see that a missing item returns zero instead of an error and loop over the results. You will use the most_common method to list the items that appear most often, which is perfect for finding the top categories or the most frequent words in a text.
You will update a Counter with more data, and combine counts from different sources by adding or subtracting Counters. You will practise by splitting a short invented paragraph into words, converting them to lowercase and counting them, and by counting the risk levels in a small register.
You will also compare it with a set, which answers whether something is present but not how many times.
By the end of this lecture you will be able to count items quickly and find the most common values.
As programs grow, keeping all the code in a single file becomes hard to manage. Python lets you split code into several files, called modules, and import them just as you do the built-in ones. In this lecture you will write your own module.
You will begin by creating a small file that contains a few useful functions, such as ones that calculate a risk score or format a label. You will save it in the same folder as your main script and give it a clear, lowercase name. You will then import it from the main script and call its functions with dot notation, as you did with math.
You will see that every Python file is already a module, and that the file name without the extension becomes the module name. You will learn why the location matters, and read the ModuleNotFoundError that appears if Python cannot find your file, which is usually because the script is run from a different folder.
You will also explore what happens when a module is imported. Python runs its code once and remembers the result, so a second import does not run it again. You will see the effect by putting a print call at the top level of a module.
You will discuss good organisation, grouping related functions in one module, choosing descriptive names and keeping each module focused on one job, and you will practise by moving the helper functions from an earlier script into a module.
By the end of this lecture you will be able to create and import your own modules and organise code into separate files.
When you import a module, Python runs everything at its top level. That is a problem if the module also contains code that is meant to run only when you launch the file directly, such as a demonstration or a test. In this lecture you will learn the name equals main guard.
You will begin by recalling the effect of importing a module that contains a print call at its top level. The message appears every time anyone imports it, which is rarely what you want.
Next you will meet the special variable name. Python sets it automatically for every module. When a file is run directly, its name variable equals the text main. When it is imported, name is set to the module's own name instead. You will print it in both situations and see the difference.
You will then write the guard, an if statement that checks whether name equals main and puts the demonstration code inside it. You will run the file directly and see the demonstration, then import it from another script and see that the demonstration does not run, while the functions are still available.
You will learn the common pattern of writing a main function that holds the program's steps, and calling it from inside the guard. This keeps the top level clean and makes the file useful both as a program and as a library.
You will practise by adding a guard to your risk helper module, with a short example of its use.
By the end of this lecture you will be able to use the guard to make files that work both as scripts and as importable modules.
Beyond the standard library, thousands of packages are shared by the Python community, and the tool for installing them is pip. In this lecture you will install a package with pip.
You will begin with the idea of a package index, an online catalogue of software, and with pip, the command line program that downloads packages from it. You will learn how to open a terminal, check that pip is available and read its version, and why it is usually best to run it as python -m pip so that you know which Python it belongs to.
Next you will create a virtual environment, activate it and install a small, widely used package with pip install. You will watch what the output tells you, including the version that was chosen and any dependencies that came along. You will then import the package in a script and use one simple feature to confirm that it works.
You will learn related commands. The list command shows what is installed, show gives details about one package, uninstall removes it and installing with a version number, such as double equals followed by a version, selects a specific release. You will see the error that appears when a package name is misspelled.
You will also learn good habits. You should choose packages that are well known and documented, read the project page before installing and avoid installing into the global environment so that your experiments stay separate.
By the end of this lecture you will be able to install, list and remove packages and use them in your scripts.
A project that works on your computer may fail on someone else's because they have different versions of its packages. A requirements file solves this by recording exactly what the project needs. In this lecture you will record dependencies in requirements.txt.
You will begin by explaining the problem. A script that uses a library may behave differently, or fail completely, with another version of it. If you share your code, you must also share the information that makes it work.
Next you will create a requirements file. It is a plain text file with one package per line, usually with a version, such as the package name followed by double equals and a version number. You will write one by hand, and also generate one from your current environment with pip freeze, redirecting the output into a file. You will read the result and notice that it includes the packages that your packages depend on.
You will then use the file. You will create a new, empty virtual environment, run pip install with the dash r option and the file name, and confirm that the same packages and versions appear. This is how someone else, or a server, recreates your setup.
You will discuss the difference between loose and pinned versions, and why exact pins give repeatable results while ranges allow updates. You will also consider keeping development tools in a separate file.
By the end of this lecture you will be able to create, read and use a requirements file to make a project reproducible.
How do you know that your functions still work after you change them? Checking by hand is slow and easy to forget. A better habit is to write small tests that check your code automatically. In this lecture you will write small tests with assert.
You will begin with the assert statement. It checks that a condition is true and does nothing if so. If the condition is false, it raises an AssertionError and stops the program. You will try simple examples, and add a message after a comma to explain what failed.
Next you will test a real function. You will write a function that calculates a risk level from a score and then write several assert lines that call it with known inputs and compare the results with the answers you expect. You will include normal cases, boundary values and unusual inputs, and see how one failing assertion reveals exactly which case is wrong.
You will organise the checks into a function, such as one called run_tests, and call it from the main guard. You will make a test fail on purpose, read the message and fix the function, which shows how tests catch mistakes quickly. You will learn that tests are also a form of documentation, because they show how a function is supposed to behave.
You will also see how to test that an error is raised, using try and except inside a test, and mention that frameworks such as unittest and pytest build on these ideas.
By the end of this lecture you will be able to write simple tests with assert and use them to check and protect your code.
As programs become more important, print statements are no longer enough. Messages need levels, timestamps and a place to be stored. The logging module provides all of this. In this lecture you will log messages with the logging module.
You will begin with the weakness of print. It has no levels, so you cannot separate routine information from serious problems. It has no timestamps, and turning it off means deleting lines of code. Logging solves all three.
Next you will import logging and learn the standard levels from debug, info and warning to error and critical. You will call logging.basicConfig to set the minimum level and a format that includes the time, the level and the message, and then call functions such as logging.info and logging.error. You will change the level and see messages appear or disappear without changing the code that produces them.
You will send messages to a file by giving basicConfig a file name, and compare the result with the console. You will use logging.exception inside an except block to record the full traceback of an error. You will learn to pass values as arguments instead of building the message by hand, and to never write passwords or personal data to a log.
You will then add logging to one of your earlier scripts, such as the file reader, recording the file opened, the number of lines read and any problems.
You will also see why logs matter for governance, since they provide a record of what a system did and when.
By the end of this lecture you will be able to configure logging, choose sensible levels and write messages to the console and to a file.
Machine learning begins with data, and in Python the standard tool for handling tables of data is pandas. In this lecture you will install pandas and load a CSV file into a DataFrame, the central object of data analysis.
You will begin by installing pandas into your virtual environment with pip and checking the installation by importing it and printing its version. You will learn the convention of importing it with the alias pd, which you will see in almost every example online.
Next you will meet the DataFrame. It is a table with labelled columns and numbered rows, and you can think of it as a spreadsheet inside Python. You will create a small practice CSV file with invented records about, for example, loan applications, with columns such as age, income and outcome. Every value will be synthetic and no real person will be described.
You will load the file with pd.read_csv and print the result. You will see how pandas shows the first and last rows with an ellipsis in between, and how it adds an index on the left. You will learn useful options of read_csv, such as choosing columns, setting the separator and telling pandas which values mean missing.
You will also handle errors, such as a wrong file name or a damaged file, using the try and except skills you already have.
You will discuss why governance work begins with looking at the data, since many problems in AI systems start there.
By the end of this lecture you will be able to install pandas, load a CSV into a DataFrame and display it.
Before you analyse or model any dataset, you should understand its basic shape and contents. A few simple commands tell you a great deal. In this lecture you will inspect a dataset using its shape, columns and head.
You will begin with the shape attribute, which returns the number of rows and columns as a tuple. You will unpack it into two variables and print a sentence about the dataset, such as how many records and features it has. You will use len to count rows and the columns attribute to list the column names.
Next you will use the head method to look at the first rows, and tail to look at the last ones, passing a number to choose how many. You will see why looking at actual rows is important. It can reveal problems that statistics cannot, such as a column that contains text where numbers were expected, or values that appear in the wrong column.
You will use the dtypes attribute and the info method to see the data type of each column and the number of non-missing values, and learn what object, int64 and float64 mean. You will also use sample to look at random rows, which is better than head when a file is sorted.
You will build a small function that prints a short, readable overview of any DataFrame, and use it on your practice file. You will connect this to governance by treating inspection as the first step in documenting a dataset.
By the end of this lecture you will be able to inspect the size, columns, types and first rows of a dataset.
Datasets usually contain more than you need for a particular question. You might want just a few columns, or only the rows that match a condition. In this lecture you will select columns and filter rows in a pandas DataFrame.
You will begin with selecting a single column using square brackets and its name, which returns a Series, a one-dimensional column of values. You will select several columns by passing a list of names, which returns a smaller DataFrame, and learn why the double brackets are needed. You will read the KeyError that appears when a name is misspelled.
Next you will filter rows. You will write a condition such as a comparison on a column, which produces a Series of True and False values, and use it inside square brackets to keep only the rows where it is True. You will combine conditions with the ampersand for and and the vertical bar for or, putting each condition in parentheses, and learn why Python's usual and and or words do not work here.
You will use the isin method to match any of several values, and the str accessor to test text columns. You will also meet loc and iloc, which select by label and by position, and use loc to choose both rows and columns in one step.
You will practise by answering questions such as how many applicants are over a certain age, and by selecting the outcome of those with a high income. You will check each result by looking at the rows returned.
By the end of this lecture you will be able to select columns, filter rows with conditions and combine them.
Looking at individual rows will not tell you what a whole dataset looks like. Summary statistics describe it in a few numbers. In this lecture you will summarise data with descriptive statistics.
You will begin with the describe method. In a single call, it reports the count, mean, standard deviation, minimum, quartiles and maximum of each numeric column. You will learn to read these numbers critically. A mean far from the median suggests that the data is skewed, a very large maximum suggests an outlier and a count smaller than the number of rows reveals missing values.
Next you will calculate individual statistics with methods such as mean, median, min, max, sum and std on a column, and understand what each one tells you. You will use value_counts to count how often each category appears in a text column, and the normalize option to show proportions. This is vital for governance, because the balance of the outcome and of groups in a dataset affects how a model will behave.
You will use groupby to calculate statistics for each group, for example the average income for each outcome, which is a first step toward looking at how groups differ. You will see how to compare numbers across groups side by side.
You will practise by writing a short summary of the practice dataset in plain language, noting anything surprising. You will remember that a pattern in a sample is not proof of cause, and that a summary can hide differences between groups.
By the end of this lecture you will be able to compute and interpret descriptive statistics and group summaries.
Missing values are among the most common problems in real data, and ignoring them can lead to wrong results or errors. In this lecture you will check for missing values in a DataFrame.
You will begin with the way pandas represents a missing value, usually as NaN, which stands for not a number. You will create a small practice dataset with a few deliberate gaps. You will use the isna method to produce a table of True and False values showing where data is missing, and sum it to count the missing values in each column. You will calculate the percentage missing in each column by dividing by the number of rows.
Next you will find the rows that contain a missing value, using any across the columns, and look at them to understand the pattern. You will ask whether the missing values are clustered, for example whether they occur mostly for one group, since that affects fairness as well as accuracy.
You will then meet the main ways to deal with missing data. You will use dropna to remove rows or columns that contain gaps, and fillna to replace them with a chosen value, such as zero, the mean or the most common category. You will discuss the consequences of each choice. Dropping rows reduces the data and may remove some groups more than others, and filling invents information that was not recorded.
You will write a short function that reports the missing values in any DataFrame.
By the end of this lecture you will be able to detect, count and handle missing values and explain the trade-offs.
A supervised machine learning model learns to predict one column, called the label, from other columns, called the features. Keeping them separate is the first step of any modelling task. In this lecture you will separate features and labels.
You will begin with the concepts. The label, often called the target and written as y, is the thing you want to predict, such as whether a loan application was approved. The features, written as X, are the information used to make the prediction, such as age and income. You will look at your practice dataset and decide which column is the label and which are features.
Next you will do the separation. You will select the label column into a variable called y, and use the drop method with the columns argument to create X from everything else. You will check the shapes of both, confirming that they have the same number of rows, and print the first rows of each.
You will learn why this matters for governance. Some columns should not be used as features. An identifier carries no useful meaning, a column that is recorded after the outcome would leak the answer into the model and a sensitive attribute needs a deliberate decision. You will discuss how choosing features is a governance decision as well as a technical one, and document your choice in a comment or a small dictionary.
You will also see that scikit-learn expects numeric features, and convert a simple text column into numbers with a mapping or with pd.get_dummies.
By the end of this lecture you will be able to separate features from labels, check their shapes and justify the choice of features.
A model that is tested on the same data it was trained on can look perfect while being useless on new cases, a problem called overfitting. To measure real performance, you hold back part of the data for testing. In this lecture you will split data into training and test sets.
You will begin with the idea using an everyday comparison. A student who memorises the answers to practice questions will do well on those questions but may fail an exam with new ones. A model is the same, and the test set plays the role of the exam.
Next you will install scikit-learn and import the train_test_split function. You will call it with X, y, a test_size such as zero point two and a random_state, and receive four objects: the training features, the test features, the training labels and the test labels. You will check their shapes and confirm that the sizes match the split you chose. You will learn why the random state matters, because fixing it makes the split repeatable, which is important for audits and for comparing results.
You will then meet stratification. With the stratify argument, the proportion of each label is kept the same in both parts, which is important when one outcome is rare. You will compare the proportions with and without it.
You will discuss that the test set must stay untouched until the final evaluation.
By the end of this lecture you will be able to split data into training and test sets, make the split repeatable and use stratification.
Now you have everything you need to train a model. Training means showing the model many examples so that it learns the relationship between features and labels. In this lecture you will train your first model with scikit-learn.
You will begin with the structure of scikit-learn. Models are objects that share the same simple interface: you create the model, call fit with training data to learn and later call predict to use it. You will choose a simple, well understood model, such as logistic regression or a decision tree, and explain in plain language what it does.
Next you will import the model class, create an instance and call fit with the training features and labels. You will see that the call takes a moment and returns the model itself, and that nothing is printed because the learning happens inside the object. You will then inspect what the model has learned, such as the coefficients of a logistic regression, and discuss how simple models are easier to explain, which is valuable for governance.
You will see the errors that beginners commonly meet. Text values in the features raise a ValueError because the model needs numbers, and missing values do the same for many models. You will fix them with the techniques from earlier lectures.
You will also set the random state of the model, where one exists, so that training is repeatable.
You will record the model type, the settings and the training data size in a small dictionary, which is the start of the documentation that governance requires.
By the end of this lecture you will be able to create, train and inspect a scikit-learn model.
A trained model is only useful if it can make predictions, and you need to know how good they are. In this lecture you will make predictions and measure accuracy.
You will begin by calling the predict method of your trained model on the test features, which returns an array of predicted labels, one for each test row. You will print the first few predictions next to the true labels to see how they compare, and notice that some match and some do not.
Next you will measure accuracy, the fraction of predictions that are correct. You will calculate it by hand, by comparing the two arrays and averaging the matches, and then with the accuracy_score function from sklearn.metrics, and confirm that they agree. You will compare the accuracy on the training data with the accuracy on the test data and discuss what a large gap means.
You will learn why accuracy alone can mislead. Imagine a dataset in which ninety percent of cases have the same outcome. A model that always predicts that outcome would be ninety percent accurate while being completely useless. You will compute the proportion of the most common label as a baseline and compare it with the model's accuracy.
You will also use predict_proba, if available, to see the probabilities behind the decisions.
You will record the accuracy, the baseline and the date in your model record, and consider how this information supports review and accountability.
By the end of this lecture you will be able to generate predictions, compute accuracy and compare it with a baseline.
Accuracy gives one number, but it does not show what kind of mistakes a model makes. A confusion matrix does. In this lecture you will read errors with a confusion matrix.
You will begin with the idea for a yes or no prediction. There are four possible results for each case. A true positive is a case that the model correctly predicted as yes, a true negative is correctly predicted as no, a false positive is predicted yes but is really no, and a false negative is predicted no but is really yes. You will tie each one to a concrete governance example, such as wrongly rejecting a good application or wrongly approving a risky one.
Next you will use confusion_matrix from sklearn.metrics on your test labels and predictions. You will print the result as a two-by-two table and learn how to read the rows and columns, checking that the numbers add up to the size of the test set. You will unpack the four values with ravel, and label them.
You will calculate measures from the table, such as precision, which asks how many predicted positives were right, and recall, which asks how many real positives were found. You will see that the two kinds of error have different costs depending on the situation, and why a governance team must decide which matters more.
You will also see how the confusion matrix would look for different groups of people, which leads naturally to the fairness work later in the course.
By the end of this lecture you will be able to build and read a confusion matrix and calculate precision and recall.
Governance starts from principles, such as fairness, transparency, accountability and privacy. To use them in code, you need to represent them in a form that a program can read. In this lecture you will represent AI governance principles as data.
You will begin with a short list of widely discussed principles and a plain-language description of each. You will explain that principles are only useful if they are turned into specific, checkable requirements, and that representing them as data is the first step.
Next you will build the data structure. You will create a dictionary in which each key is a principle name, and each value is another dictionary with fields such as a description, an owner and a list of requirements. You will use lists for the requirements and consider the right type for each field. You will print the structure in a readable way with loops and f-strings.
You will practise accessing and updating the data, adding a new principle, finding the requirements of a given one and counting how many requirements exist in total. You will then save the structure to a JSON file and load it back, so that the principles are stored outside the code and can be reviewed by people who do not write Python.
You will discuss why keeping policy in data matters. It can be changed without editing the program, it can be versioned and audited and it can be shared with colleagues.
By the end of this lecture you will be able to model governance principles and requirements as structured data and store them in JSON.
Risk management is at the heart of AI governance, and a risk register is the standard tool for it. It is a list of risks, each with a description, an owner and an assessment. In this lecture you will build a risk register in Python.
You will begin by deciding what each entry needs. You will include an identifier, a title, a description, a category such as privacy or fairness, an owner, a likelihood, an impact and a status. You will represent one risk as a dictionary and the register as a list of dictionaries, which you will recognise from your work with CSV and JSON.
Next you will write functions to work with the register. One adds a new risk after checking that the required fields are present and that the identifier is unique. Another finds a risk by its identifier. A third updates a field, and a fourth lists all the risks in a readable table using f-strings. You will use try and except to handle a missing identifier and raise a clear error.
You will populate the register with several invented risks, such as a model that may treat groups unequally or a dataset that may contain personal data, and print it. You will save it to a file in JSON and load it back, and mention that a CSV copy can be useful for people who prefer spreadsheets.
You will discuss good practice, including clear ownership, dates for review and a history of changes.
By the end of this lecture you will be able to build, search, update and store a simple risk register.
A list of risks is more useful when you can compare them. Scoring gives each risk a number, and a common method multiplies the likelihood by the impact. In this lecture you will score a risk using likelihood times impact.
You will begin with the idea. Likelihood describes how probable it is that the risk occurs, and impact describes how serious the consequences would be. Each is rated on a simple scale, such as one to five, with defined meanings. Multiplying them gives a score from one to twenty-five, which is easy to calculate and easy to explain.
Next you will write a function that takes a likelihood and an impact and returns the score. You will validate the inputs, checking that both are whole numbers within the allowed range, and raise a ValueError with a helpful message otherwise. You will test the function with the assert statements that you have learned, including the smallest and largest possible values and invalid inputs.
You will then apply it to the register. You will loop over the risks, calculate each score and store it in a new key, and print the register with the scores. You will consider the limits of this method. The scale is subjective, the same score can come from very different combinations and a simple product can understate a rare but catastrophic risk.
You will discuss how governance teams document their scales so that scores are consistent between reviewers.
By the end of this lecture you will be able to calculate and validate risk scores and explain the strengths and limits of the method.
A numeric score is useful for ranking, but decision makers often prefer categories such as low, medium, high and critical. In this lecture you will turn scores into risk tiers.
You will begin by defining the tiers and their thresholds, for example low below five, medium from five to nine, high from ten to fifteen and critical above fifteen. You will explain that the boundaries are a policy choice that an organisation must set and record, rather than a technical fact, and you will store them in a data structure rather than hiding them in the code.
Next you will write a function that takes a score and returns a tier. You will use an if, elif and else chain and test every boundary value carefully, since an error of one at a boundary changes the tier. You will write assert statements for each boundary, and see how the tests protect you if the thresholds are later changed.
You will then improve the design by driving the function from the data. You will store the tiers as a list of pairs of an upper limit and a name and loop through them, so that changing a policy means changing the data instead of the logic. You will compare the two approaches.
You will apply the function to your risk register, adding a tier to each risk, and print a summary showing how many risks fall into each tier, using the Counter.
By the end of this lecture you will be able to classify scores into tiers, test the boundaries and drive the logic from data.
Once every risk has a score, you will want to see the most serious ones first. Sorting is the tool for this. In this lecture you will rank risks with the sorted function.
You will begin with the basics of sorting a list of numbers and a list of text with sorted, which returns a new list, and with the list's sort method, which changes the list itself. You will use the reverse option to sort from highest to lowest and see how Python orders text, with uppercase before lowercase by default.
Next you will sort records. A list of dictionaries has no natural order, so you must tell sorted what to sort by. You will use the key parameter with a function that takes one risk and returns its score. You will first write the function with def, then replace it with a lambda, a short anonymous function, and compare the two. You will sort the register from the highest score to the lowest and print the top five.
You will learn about sorting by several criteria. By returning a tuple from the key function, such as the score and then the title, you will break ties in a predictable way. You will also learn that Python's sort is stable, which means items with equal keys keep their original order.
You will use slicing to take the top few and the bottom few and write a function that returns the highest-ranked risks for a report.
You will test the result by checking that the list is in the right order.
By the end of this lecture you will be able to sort lists of records by one or more fields and extract the top results.
A governance policy often says that every record must contain certain information. A risk must have an owner, a model must have a version and a dataset must have a description. Checking this by hand does not scale. In this lecture you will write policy as code, starting with required fields.
You will begin with the idea. A policy written in a document is open to interpretation and easy to forget. A policy expressed in code can be run automatically, every time, and gives the same answer to everyone. This approach is often called policy as code, and it is a major theme in modern governance engineering.
Next you will express the policy as data, a list of the required field names. You will write a function that takes a record, which is a dictionary, and the list of required fields, and returns the names of the fields that are missing or empty. You will treat a field with an empty string or a value of None as missing, and test your function with complete and incomplete records.
You will apply it to every risk in your register and print a report that lists each failing record and what it lacks. You will count how many records pass. You will discuss the importance of writing messages that tell people exactly what to fix.
You will also consider that checking a field exists is only the first level, since a real policy may also require valid values.
By the end of this lecture you will be able to express a required-fields policy as data and enforce it with a function.
A single check is useful, but governance involves many rules applied together. A compliance check function gathers them and gives a clear result. In this lecture you will write a compliance check function.
You will begin by designing the output. A good check returns more than a simple yes or no. It returns whether the record passed, the list of rules that failed and a short explanation for each. You will represent this as a dictionary with keys such as passed and reasons, which makes the result easy to print, store and test.
Next you will write several small rule functions, each of which examines one thing and returns either None or a message. One checks that an owner is present, another that the score is within the valid range and a third that a high-tier risk has a mitigation plan. Each rule is simple and has a clear name, which is easier to test and explain than one large function.
You will then write the main function. It receives a record and a list of rules, runs each rule, collects the messages and returns the result. You will run it on several records, with a mixture of passing and failing cases, and write assert tests for each.
You will discuss why structuring rules as separate functions allows a governance team to add, remove and review rules without rewriting the program, and why returning reasons supports accountability.
By the end of this lecture you will be able to build a compliance check from small rule functions and return a clear, explainable result.
You often need to answer questions about an entire list of results, such as whether every check passed or whether any check failed. Python has two built-in functions for this, all and any. In this lecture you will decide pass or fail with all and any.
You will begin with all. It takes a sequence of true and false values and returns True only if every one is True, and it returns True for an empty sequence. You will use it on a list of check results to decide whether a record is fully compliant. Then you will meet any, which returns True if at least one value is True, and False for an empty sequence. You will use it to ask whether any check has failed.
Next you will combine them with a generator expression, which is like a list comprehension without the square brackets. You will write expressions such as all of the results of a check for each rule, and see how they read almost like English. You will explain that these functions stop as soon as the answer is known, which makes them efficient.
You will apply them to your compliance system. A record passes only if all rules pass, and a register needs attention if any record is critical. You will write a function that returns an overall status for a register and a function that returns the names of the failing rules.
You will also test the edge cases of empty lists and think about whether they match what you want a policy to do.
By the end of this lecture you will be able to use all and any to combine results into a clear decision.
As a register grows, you need ways to see its shape. Grouping risks by their tier shows how many are critical and who needs to act. In this lecture you will group risks by tier.
You will begin with a list of risk dictionaries, each with a tier. You will build a dictionary whose keys are tier names and whose values are lists of the risks in that tier. You will do it first with a loop, checking whether the key exists before appending, and then with the setdefault method and with defaultdict from the collections module, which creates the empty list for you. You will compare the three versions and see why the last is shortest.
Next you will use the grouped data. You will loop over the groups in a sensible order, such as critical to low, rather than the order in which they were created, and print the title of each risk beneath its tier heading. You will count the risks in each group with len and calculate the percentage of the total.
You will also group by other fields, such as the category or the owner, to see where responsibility lies, and write a general function that groups a list of records by the value of any key. You will test it on small examples.
You will learn that pandas offers groupby for the same task on tables, and compare the two approaches.
You will produce a short summary of the register for a review meeting.
By the end of this lecture you will be able to group records by a field and summarise the groups.
The final step of any governance check is a record of what was found. An audit report must be stored in a form that people and other programs can read. In this lecture you will save an audit report as JSON.
You will begin by designing the report. It includes metadata, such as a report title, the date and time, the tool version and the name of the person or system that produced it. It then contains the results, such as the number of risks checked, the number that passed, the failures with their reasons and a summary by tier. You will assemble these into a dictionary, with nested dictionaries and lists.
Next you will convert any values that JSON cannot represent. You will turn dates into text in a standard format, and sets into sorted lists. You will write the report with json.dump, using indent for readability and sort_keys for a stable order, inside a with statement and with an explicit UTF-8 encoding.
You will build the file name from the date, so that each run creates a new file instead of overwriting the previous one, and create the output folder with pathlib if it does not exist. You will add error handling for problems when writing, and logging to record where the report was saved.
You will then read the report back, verify that it matches what you wrote and print a short summary from it.
You will discuss why reports should never be silently overwritten, since an audit trail depends on history.
By the end of this lecture you will be able to assemble an audit report and save it safely as a dated JSON file.
Data governance begins with a simple question: is the data complete? A record with missing values can produce misleading analysis and unreliable models. In this lecture you will spot missing values in records using plain Python.
You will begin with a small list of invented customer records, each stored as a dictionary, in which some fields are empty, set to None or missing entirely. Every record is synthetic, and none describes a real person. You will print them and see the problem for yourself.
Next you will define what missing means in your policy. A key that is absent, a value of None, an empty string and a string containing only spaces may all count as missing, and you will write a small helper function that returns True for any of them. You will test it with each case and make sure that a legitimate zero is not treated as missing, which is an easy mistake.
You will then loop over the records and fields. For each record, you will collect the names of the fields that are missing, and for each field you will count how many records lack it. You will use a dictionary or a Counter for the counts and calculate the percentage missing, formatted with an f-string.
You will print a clear report listing the worst fields first, and flag any field that crosses a threshold that you define, such as more than ten percent. You will discuss why you must understand why data is missing before deciding what to do about it.
By the end of this lecture you will be able to define missing values, count them by field and report them against a threshold.
Values can be present and still be wrong. An age of two hundred or a negative income should never pass a data quality check. In this lecture you will check value ranges.
You will begin by explaining what a range check does. For each field that should be numeric, you define the smallest and largest acceptable values, and any value outside that range is flagged. You will express the rules as data, a dictionary that maps field names to a minimum and a maximum, so that the policy is visible and easy to change.
Next you will write a function that checks one value against a range and returns True or False, taking care with values that are missing or that are not numbers. You will handle text that cannot be converted using try and except, treating it as invalid instead of crashing, and make sure that the boundary values themselves are accepted by using the right comparison operators.
You will apply the function to a list of invented records. For each record, you will gather the problems found as a list of messages that include the record's position, the field and the offending value, and print a report. You will count the total number of violations and the number of records affected.
You will also discuss categorical rules, such as checking that a status field contains only allowed values, and implement it with a set. You will write tests with assert for the boundary conditions.
By the end of this lecture you will be able to define range rules as data, validate values and report violations clearly.
Duplicate records waste storage, distort statistics and can lead a model to see the same example several times. In this lecture you will find duplicate records.
You will begin with the two kinds of duplicates. An exact duplicate is a row that is identical to another in every field, and a duplicate by key is a row that shares an identifier, such as an email or a customer number, with another row even though other fields differ. Both matter, but they require different handling.
Next you will write a function that finds duplicates by key. You will loop through the records and keep a dictionary that maps each key to the positions where it appears, or use a set of keys seen so far and a list for the repeats. You will normalise the key first, trimming spaces and converting text to lowercase, because values such as an email written in capitals and in lowercase are really the same.
You will then find exact duplicates by turning each record into a tuple of its values, which can be placed in a set or used as a dictionary key. You will count how many records are duplicated and how many extra copies there are.
You will produce a report that lists each group of duplicates with the positions of its members, and write a function that returns a cleaned list with the first occurrence kept.
You will test with invented records that contain known duplicates, and discuss why removal needs a human decision when the copies differ.
By the end of this lecture you will be able to detect exact and key-based duplicates and report them.
You have written checks for missing values, ranges and duplicates. Governance teams do not want three separate printouts. They want a single data quality report that summarises everything. In this lecture you will build a data quality report.
You will begin by designing the report's structure. It will have a header with the dataset name, the date and the number of records, and sections for completeness, validity, uniqueness and an overall result. You will represent it as a dictionary, which makes it easy to print, save and test.
Next you will assemble the report from your earlier functions. You will call the missing value check, the range check and the duplicate check, and collect their results into the report. You will calculate summary measures, such as the percentage of records with no problems and a simple score for each dimension of quality. You will set thresholds for each, and an overall status of pass, warning or fail that is calculated from them.
You will then present the report. You will write a function that prints it neatly with f-strings, aligning columns and using clear headings, and another that saves it as JSON, building on what you did in the previous section. You will log the status and store the report with a dated file name.
You will test the report on a clean dataset and on one with deliberate problems, and check that the status changes as expected.
You will also discuss the value of tracking quality over time.
By the end of this lecture you will be able to combine several checks into one structured, saved report.
Personal information often hides in text fields, such as notes and comments, and an email address is among the easiest kinds to find. In this lecture you will find emails with regular expressions, using synthetic text only.
You will begin by introducing regular expressions, patterns that describe the shape of text. You will import the re module and try simple patterns, such as matching a word or a digit, using re.search and re.findall. You will learn the building blocks you need: character classes in square brackets, the plus sign for one or more, the dot, the backslash sequences for digits and word characters and the anchors.
Next you will build a pattern for an email address from parts, with a sequence of allowed characters, an at sign, a domain made of letters, digits and dots and a final top-level domain. You will test it against invented examples, including addresses with dots and plus signs and some that are not valid, such as a missing at sign. You will see that no simple pattern is perfect, and decide how strict to be.
You will use findall to extract every email in a longer piece of text, and finditer to get the position of each match. You will count them and print a short report.
You will discuss the idea of false positives and false negatives in detection, because a pattern that is too loose flags harmless text while one that is too strict misses real data.
By the end of this lecture you will be able to write and test a regular expression and use it to find emails in text.
Emails are only one kind of personal information. Phone numbers and identification numbers have their own shapes, and a privacy check must find them too. In this lecture you will detect phone numbers and ID numbers using invented formats.
You will begin by looking at how phone numbers are written. They may include a country code, brackets, spaces, dashes or dots, and the same number can be formatted in many ways. You will write a pattern that allows these variations, using optional groups, the question mark and counted repeats in curly braces, and test it on several invented examples. You will use clearly fictional numbers only.
Next you will create a pattern for an invented identification number format, such as three digits, a dash, two digits, a dash and four digits. You will learn to use word boundaries so that the pattern does not match part of a longer string of digits, and see the false positives that occur without them.
You will build a dictionary that maps a name, such as email, phone and id, to its compiled pattern, created with re.compile for speed and clarity. You will write a function that scans a piece of text with all the patterns and returns the types of personal data found, together with counts.
You will test the function with texts that contain no personal data, one type and several types, and compare the results with what you expect. You will discuss why detection is imperfect and the importance of human review.
By the end of this lecture you will be able to detect several kinds of personal data with compiled patterns.
Finding personal information is only half of the job. Often you must also hide it before sharing data or writing it to a log. This is called masking. In this lecture you will mask personal information.
You will begin with the goal. A masked value no longer reveals the original, but it may keep some structure, such as the length or the last few characters, so that the data remains useful. You will discuss the trade-off between usefulness and protection, and how the appropriate level depends on the purpose.
Next you will use re.sub, which replaces every match of a pattern with new text. You will replace emails with a placeholder such as a label in square brackets, and then write a function that keeps the first letter and the domain while hiding the rest of the name. You will use a function as the replacement, which receives the match object and returns the new text, to build more flexible masking.
You will mask phone numbers by keeping only the last four digits, and identification numbers by replacing every digit with an asterisk. You will combine the patterns in one function that masks all the types in a piece of text, and test that the result no longer contains the original values by running the detection code on it.
You will discuss what masking does not do. It does not make a dataset anonymous, since other fields may still identify a person, and simple masking can sometimes be reversed.
You will practise with invented notes.
By the end of this lecture you will be able to replace personal data in text with masked values and verify the result.
Your detection functions work on text, but real data lives in files. In this lecture you will scan a CSV file for personal data, combining file handling with pattern matching.
You will begin by creating a synthetic CSV file with columns such as name, email, notes and department. Every value is invented. Some of the personal information is in the obvious columns, and some is hidden in the free-text notes, which is exactly where real problems are often found.
Next you will read the file with csv.DictReader inside a with statement. For each row and each column, you will run your detection function on the value and record any findings. You will store the results in a structure that tracks the row number, the column name and the type of data found, but never the data itself, because a report that repeats personal data would create a new problem.
You will build a summary by column that shows which columns contain personal data and how often. You will use a Counter for the counts and present the results in a table made with f-strings. You will decide on a threshold, such as flagging any column where more than a small percentage of rows contain a finding.
You will handle practical details, such as missing values, very long cells and a file that cannot be found, with try and except and logging. You will measure how long the scan takes for a larger generated file.
You will save the findings to a JSON report.
By the end of this lecture you will be able to scan a file for personal data and report the findings without exposing the values.
After finding personal data in a dataset, a common next step is to produce a version that can be shared more safely. In this lecture you will write a masked copy of a dataset.
You will begin by planning the process. For each column, you will decide on an action: keep it as it is, drop it, mask it with the text functions that you wrote or replace it with a pseudonym. You will store this plan as a dictionary, so that the decisions are explicit, reviewable and easy to change.
Next you will read the original CSV with DictReader and write a new CSV with DictWriter, applying the plan to every row. For a pseudonym, you will use the hashlib module to create a short, consistent code from the original value together with a secret salt, so that the same person receives the same code in every row, which preserves the ability to count and group. You will keep the salt separate from the data, and discuss that it should be protected.
You will apply masking to free-text columns with the function from the earlier lecture, and drop the columns that are not needed. You will never overwrite the original file, and the output file name will make it clear that it is a masked copy.
You will then check the result by running your scanner on the new file, and confirm that it finds nothing. You will compare the number of rows in both files and log what was done.
You will discuss the limits of masking and the need for further review before sharing.
By the end of this lecture you will be able to apply a column-by-column plan to create a masked dataset and verify it.
Good governance depends on documentation. Anyone who uses a dataset should know what it contains, where it came from, how it was prepared and what it should and should not be used for. In this lecture you will generate a dataset documentation file.
You will begin with the idea of a datasheet for a dataset, a short document that records the key facts. You will list the items to include: the name, a description, the source, the collection date, the owner, the number of rows and columns, a description of each column, the known quality issues and the personal data findings, the permitted uses and the date of the last review.
Next you will gather as much of this as possible automatically. You will count the rows and columns, detect each column's data type from its values, calculate the percentage of missing values and list a few example values, taking care not to show personal data. You will combine this with the information that a person must supply, such as the owner and the permitted uses, which you will store in a dictionary that you fill in.
You will then write the documentation. You will generate a Markdown file with headings, a table of columns and bullet points for the issues, using f-strings and loops, and save it next to the dataset with pathlib. You will also save the same information as JSON so that other programs can read it.
You will check the result by opening the file, and discuss how to keep the documentation up to date by regenerating it whenever the dataset changes.
By the end of this lecture you will be able to generate clear, structured documentation for a dataset automatically.
Fairness is one of the central concerns of AI governance, and the first step in measuring it is to see how a model's decisions are distributed across groups. In this lecture you will measure selection rate by group.
You will begin with the definition. The selection rate of a group is the proportion of its members who receive the favourable outcome, such as being approved. If one group is selected far more often than another, that is a signal that deserves investigation. You will use a synthetic dataset with a made-up group attribute and a model's predictions, and no real people are involved.
Next you will calculate the selection rate by hand. You will loop through the records, count the members of each group and the number of favourable decisions in each, and divide. You will store the counts and rates in dictionaries, and print a neat table with f-strings. You will handle the case of a group with no members to avoid division by zero.
Then you will do the same with pandas. You will use groupby on the group column and take the mean of a column of ones and zeros, which gives the selection rate in a single line, and compare the result with your manual calculation.
You will discuss what the numbers can and cannot say. Differences might reflect differences in the underlying data, and small groups produce noisy rates, so you will always display the size of each group next to its rate.
By the end of this lecture you will be able to calculate and present selection rates for each group.
Once you can calculate the selection rate for each group, you can compare them. A common measure is the demographic parity gap. In this lecture you will measure the demographic parity gap.
You will begin with the definition. Demographic parity asks whether the favourable outcome is given at the same rate to every group. The gap is the difference between the highest and lowest selection rates, and a gap of zero means perfect parity. You will also meet the ratio of the lowest rate to the highest, which is sometimes compared with a threshold such as eighty percent, often called the four-fifths guideline, although the right threshold depends on the context and the applicable rules.
Next you will write a function that takes the selection rates and returns the gap and the ratio. You will use max and min on the dictionary values, handle the case with fewer than two groups and test the function with assert on simple numbers that you can check by hand.
You will apply it to the synthetic dataset and print the result. You will then add a policy check, comparing the gap with a limit stored in your policy data and returning a pass or a fail with an explanation, which connects directly to the compliance functions you wrote earlier.
You will discuss the limits of this measure. It is only one definition of fairness, it ignores whether groups differ in the characteristics relevant to the decision and different fairness measures can conflict.
By the end of this lecture you will be able to compute the demographic parity gap and compare it with a policy threshold.
Governance requires that decisions can be explained. For a simple model, you can see how much each feature contributed to a particular decision. In this lecture you will explain a decision with feature contributions.
You will begin with the idea for a linear model, such as the logistic regression you trained earlier. The score for a case is built from a weight for each feature multiplied by the feature's value, plus an intercept. Each product is the feature's contribution, which shows how much that feature pushed the decision up or down.
Next you will extract the model's coefficients and the names of the features, and pair them with the values for a single synthetic case using zip. You will calculate each contribution, sort them by their absolute size and print them as a short explanation, such as which three features mattered most and in which direction. You will confirm that the contributions add up, together with the intercept, to the model's raw score.
You will turn the numbers into a readable sentence for a non-technical reader, and record the explanation along with the decision in a dictionary that could be stored for audit.
You will discuss the limits honestly. Contributions explain the model, not the real world, and a feature may stand in for another one. For more complex models, other tools are needed, and explanations can give a false sense of certainty if they are not tested.
You will also check that a decision was not driven by a feature that should not have been used.
By the end of this lecture you will be able to calculate and present feature contributions for a linear model.
A model changes over time. It is retrained, its settings are adjusted and its data is updated. If you cannot say which version made a decision, you cannot audit it. In this lecture you will track model versions in a record.
You will begin with what a model record should contain. You will include a name, a version number, the date it was trained, the training dataset and its version or hash, the main settings, the evaluation results, the owner, the approval status and the intended use. You will represent it as a dictionary.
Next you will write functions to create and update records. A function builds a record from the information provided and checks that the required fields are present using your policy code. You will generate a fingerprint of the dataset with hashlib, reading the file in chunks, so that the exact data used can be identified later. You will add the evaluation results from your earlier work, such as accuracy and the demographic parity gap.
You will store the records in a registry, a list or a dictionary keyed by name and version, and save it as JSON. You will write a function that finds the latest approved version and one that compares two versions and reports the differences in their settings and results.
You will discuss why versions should never be overwritten, and how a registry provides the trail that auditors need.
By the end of this lecture you will be able to build a simple model registry with versioned records, fingerprints and comparisons.
A model that was accurate when it was trained can become unreliable if the data it sees later is different. This change is called data drift, and governance requires that it is monitored. In this lecture you will detect data drift against a threshold.
You will begin with the idea. You keep a reference profile of the training data, such as the mean and standard deviation of each numeric feature, and compare it with new data that arrives in production. If the new data differs by more than an agreed amount, the model's behaviour may no longer be trustworthy.
Next you will compute the reference profile from a synthetic training set, using pandas or plain Python, and store it in a dictionary. You will then create two sets of new data, one drawn from the same pattern and one deliberately shifted, for example with a higher average age.
You will write a simple drift measure. A shift in the mean, expressed as a fraction of the reference standard deviation, is easy to explain and to calculate. You will compute it for each feature, compare it with a threshold stored in your policy data and flag the features that exceed it. You will also compare the proportions of categories for text columns.
You will produce a report that lists each feature, its reference and current values, the measure and the status, and an overall decision on whether to investigate.
You will discuss the limits of the simple measure, mention more formal statistical tests and consider how often monitoring should run.
By the end of this lecture you will be able to build a reference profile and flag drift against a threshold.
An overall accuracy figure can hide very different experiences for different groups. A governance review needs to see performance by group. In this lecture you will check model performance by group.
You will begin with the reasons. A model may be highly accurate for a large group and much less accurate for a small one, and the average will hide it. Differences in error rates can also have unequal consequences, such as one group experiencing more wrongful rejections.
Next you will take a synthetic test set with true labels, predictions and a made-up group column. For each group, you will calculate the number of cases, the accuracy, and the true positive rate and false positive rate from the confusion matrix counts. You will write a function that does this for one group and loops over all of them, collecting the results in a dictionary, and then check the answers with pandas groupby.
You will present the results as a table and calculate the gaps between the best and worst groups for each measure. You will compare the gaps with policy limits and report a pass or fail with reasons, using the compliance structure you already have.
You will discuss the importance of group sizes. A rate calculated from a handful of cases is unreliable, so you will show the counts and set a minimum number of cases before a result is trusted.
You will also see why different fairness measures can disagree, and why the choice of measure is a policy decision.
By the end of this lecture you will be able to compute and compare error rates and accuracy across groups.
This course contains the use of artificial intelligence.
Artificial intelligence is transforming industries, but building powerful AI systems is only half the challenge. Organizations also need professionals who can ensure these systems are responsible, fair, transparent, secure, and accountable. Welcome to AI Governance Engineer Bootcamp with Python, a comprehensive, hands-on course designed to help you develop practical technical skills in AI Governance, Responsible AI, AI Risk Management, AI Ethics, and Compliance Automation.
Featuring 100 hands-on lessons across 11 comprehensive modules, this course takes you from Python programming fundamentals to building functional AI governance solutions. Whether you are a complete beginner, software developer, data scientist, or governance professional, you will gain practical experience implementing governance controls through real coding exercises.
Unlike traditional courses that focus primarily on theoretical governance frameworks, this bootcamp emphasizes AI Governance Engineering, Policy as Code, Risk Automation, and Responsible AI Implementation using Python.
Master Python Programming and Machine Learning
Begin your journey by learning Python Programming, Data Structures, Functions, Conditional Statements, Loops, File Handling, Exception Handling, JSON, CSV, and Python Libraries. Develop essential software engineering skills through modular programming, testing, dependency management, and application logging.
Progress into Artificial Intelligence, Machine Learning, pandas, and scikit-learn. Learn to prepare datasets, train machine learning models, generate predictions, evaluate model accuracy, and interpret confusion matrices.
Build AI Governance and Risk Management Solutions
Explore the technical foundations of AI Governance, Governance Risk and Compliance (GRC), AI Risk Assessment, Risk Registers, Risk Scoring, Risk Classification, and Compliance Monitoring.
Discover how to translate governance requirements into executable Python programs using Policy as Code, Automated Policy Enforcement, Compliance Validation, and Governance Automation. Develop reusable compliance functions and generate structured audit reports.
Implement Data Governance and Privacy Controls
Learn how to build automated Data Governance, Data Quality Management, Data Privacy, Data Validation, and Data Protection solutions.
Develop Python programs to identify missing values, detect duplicate records, validate data ranges, and recognize Personally Identifiable Information (PII). Implement PII Detection, Data Masking, Regular Expressions, Privacy Engineering, Dataset Documentation, and Automated Data Quality Reporting.
Develop Responsible AI and Model Governance Skills
Discover practical techniques for Responsible AI, Trustworthy AI, AI Fairness, Algorithmic Bias Detection, AI Explainability, and Model Governance.
Measure demographic parity, calculate selection rates, analyze group-level model performance, and explain predictions using feature contributions.
Explore AI Model Monitoring, Data Drift Detection, Model Versioning, Explainable AI (XAI), Model Performance Evaluation, and AI Accountability to understand how governance controls can support the machine learning lifecycle.
Build an End-to-End AI Governance Audit Tool
Bring everything together in a practical capstone project. Build your own AI Governance Audit Tool with Python, combining automated dataset validation, model fairness checks, risk thresholds, policy verification, and structured compliance reporting.
This project demonstrates how AI Auditing, Governance Engineering, Compliance Automation, and Responsible AI Development can work together within a functional application.
Who Should Take This Course?
This bootcamp is ideal for aspiring AI Governance Engineers, AI Developers, Python Developers, Machine Learning Engineers, Data Scientists, GRC Professionals, AI Auditors, Risk Analysts, Compliance Engineers, MLOps Engineers, and Responsible AI Specialists.
No previous programming or artificial intelligence experience is required. You can complete the exercises locally using Python and freely available libraries without paid AI APIs or cloud subscriptions.
Enroll today and start developing practical skills in AI Governance Engineering, Responsible AI, AI Compliance, Risk Management, and Python Automation. Learn not just how to build AI systems, but how to evaluate, monitor, and govern them responsibly.