
This course includes our updated coding exercises so you can practice your skills as you learn.
See a demo
Learn Python for DevOps, automation, and CI/CD, from fundamentals to advanced topics, with 100+ coding exercises to solve real-world problems and simplify your work.
Master Python for devops with topics from data types and regular expressions to functions, modules, and ci/cd using boto3, ec2, and GitHub integration; includes labs and quizzes.
Explore Python for DevOps, automation, and 100+ coding exercises, covering data types, functions, modules, regex, and CI/CD with Jenkins, AWS, and GitHub integration.
Discover why Python excels in automation, web development, data analysis, and AI with its readable syntax and cross-platform reliability. Compare Python with shell scripting to decide when to use each.
Explore shell scripting as a powerful tool to automate tasks on Unix-based systems, performing file manipulation, process management, and invoking system commands to save time and reduce errors.
Compare Python and shell scripting across syntax readability, cross-platform support, available libraries, and suitability for complex automation and system administration.
Use Python for complex programs with data processing, error handling, and cross-platform needs, including networking, web scraping, or APIs; reserve shell scripting for automating simple unix tasks.
Explore Python practice setups by comparing text editors like Visual Studio Code and Sublime Text, IDEs such as PyCharm and Thonny, and browser platforms like code space and Google Colab.
Install Visual Studio Code on your laptop, then install the Python extension, create a Python practice folder, and run a simple script to see output.
Install and open PyCharm, an IDE with intelligent code completion and debugging. Create a new Python project, write a script, install the pi game module, and run the script.
Explore Codespaces, an online coding platform that lets you practice Python in your browser with no installation. Create a GitHub-based repository, write Python scripts, and run them in Codespaces.
Explore Python data types from numeric, sequence, mapping, and set categories, with examples of int, float, complex, string, list, tuple, dictionary, and boolean.
Practice Python string data types by creating variables, using single, double, or triple quotes, concatenating strings with plus operators, and printing results, including spaces, slashes, and colons for formatted output.
Practice using the float data type in Python with real numbers such as 5.0 and 2.5, performing addition, subtraction, multiplication, and division through practical scripting.
Define a string variable text and print its length using len to practice computing the length of a string in Python.
Create a Python script to measure string length with len and print result. Convert the text to uppercase with .upper() and to lowercase with .lower(), then print the results.
Practice string manipulation in Python using the built-in replace method. Create a text variable, replace Python with Linux, print the result, and run the script for DevOps.
Explore string handling in Python by using the split method to divide text into words, define a variable, and print results, including handling a delimiter and backslash examples.
Learn how to use Python's split() to divide text into objects and print a specific object by index, such as the first or second item, using print statements.
Learn how lists in Python are mutable, ordered collections defined with square brackets, printed easily, and updated by adding or removing items, with practical server IPs examples.
Explore creating and printing Python lists, fixing syntax errors with quoted strings, and modifying a list to add items, highlighting mutability in a DevOps automation context.
Practice manipulating Python lists by defining, printing, updating elements by index, and appending new items to a server IP list, illustrating list mutability in a DevOps context.
Explains how tuples form an immutable, ordered sequence in Python, compares them with lists by brackets, and shows fixed configuration examples like DB configuration.
Explore tuples in Python, print their values, and learn that tuples are immutable and cannot be modified or appended; to change data, redefine them in the main variable.
Explore sets in Python, an unordered collection of unique items that is mutable for adding or removing elements and eliminates duplicates for unique entries like server ips or user groups.
Practice teaches sets in Python by defining sets with curly braces, printing results, and using add, remove, and update to modify items.
Explore dictionaries in Python as an unordered collection of key-value pairs with unique, immutable keys such as name, age, position, salary and mutable values; demonstrated with an employee details dictionary.
Learn how to create and manipulate a Python dictionary, including adding, updating, and printing key-value pairs, with emphasis on mutability and access of keys like name, age, and salary.
Explore practical use cases of Python dictionaries in DevOps, from storing configuration and environment data to handling API responses and infrastructure details like IP addresses.
Explore boolean data types in python, where true and false drive conditional statements and logical operations using comparison operators and, or, not.
Practice session demonstrates boolean data type in python by using if else to print server status and yield true or false, with scripts from a GitHub repository for testing.
Explore regular expressions in Python with the re module to match, search, and replace patterns, and apply these tools to find error or warning lines in log files.
Practice regular expressions in python using the re module to match patterns at the start of a string, illustrated with re.match versus re.search and hello world examples.
Explore using Python's re.search to find pattern matches anywhere in a string, compare it with re.match, and employ re.findall to capture all occurrences in examples.
Explore using re.findall to extract all matches in a string, with a pattern, compare it with search, and apply re.sub to replace matches, collapsing spaces to a single space.
Learn to use Python regular expressions for DevOps tasks such as parsing logs and validating input; the lab demonstrates searching for error or warning lines in a Linux log.
Explore Python keywords, their predefined meanings, and how they structure code with for, while, if else, and def, noting case sensitivity and that keywords cannot be used as identifiers.
Explore common Python keywords and how they power conditional logic, including if, else, elif, and for loops, plus using the keyword module to list keywords.
Explore the for loop and range to print numbers, and use if and break to exit loops; compare with the while loop and the break keyword's role in control flow.
Master control flow in Python by exploring continue, def, return, class, and import keywords, with hands-on examples that skip iterations and define functions.
Learn how Python uses dynamically typed variables to store strings and integers without explicit declarations, and print variables individually or together to display multiple values.
Learn how to define and print float variables in Python, explore dynamic typing without explicit types, and work with boolean variables using true and false to control output.
Define a list variable in Python using square brackets to create an ordered, changeable collection like apples, banana and cherry; print the list, then compare with immutable tuple in parentheses.
Define a dictionary with key-value pairs in Python and a set that removes duplicates, illustrating unordered, changeable dictionaries and duplicate-free sets.
Explore local and global variables in Python by examining how scope works inside and outside functions, and learn how to define and call functions using def.
Learn how local and global variables work in Python functions by using num1 and num2 in addition and subtraction. Observe scope control and errors from undefined variables.
Explore global and local variables in Python in this lab, and learn how function scope prioritizes locally defined values over global ones.
Learn how the return statement exits a function and returns a value to the caller in Python, using def and parameters, and see add(a, b) returning a + b.
Practice lab demonstrates creating a function to add two numbers, showing results with and without a return statement, and using a variable to hold the returned value.
Define get_details in Python and use a return statement to pass multiple values, name and age, captured as a tuple by the caller.
Implement a Python function check_even that uses an if statement and modulo to determine if a number is even or odd, returning 'even' or 'odd'.
Discover how functions in Python encapsulate reusable code, using def, parameters, inputs, and return statements, and learn how to define, call, and manage simple operations like addition.
Explore the advantages of functions in Python, including code reusability, readability, and abstraction, enabling easier testing and maintainability as shown with a calculator.
Practice creating Python functions with and without parameters using def, print statements, and f-strings to display personalized greetings like 'hello world' and 'hello {name}, you are {age} years old'.
Practice defining and using Python functions with a return value by creating a function that adds two numbers and returns sum, then call it, store the result, and print it.
Design and test a Python script that creates four arithmetic functions—add, subtraction, multiply, and division—and prints results for ten and five.
Compare Python scripts with and without using functions to show how modular, reusable code supports adding, subtracting, multiplying, and dividing operations.
Learn how Python modules, files containing code, organize and reuse functions, classes, and variables across different platforms. Use import to reuse scripts across projects, improving structure and maintainability.
Learn how built-in Python modules like math, os, and sys work, and how to import and use them with functions such as math.sqrt; contrast these with user defined modules.
Create and use a custom, user defined module in Python by defining functions in a script, then importing and reusing them in another script to print results.
Explore built-in Python modules like math, random, date time, OS, JSON, and regular expressions in a practical lab, using import math to compute a square root.
Explore OS module to interact with OS, fetch current working directory with os.getcwd, list contents with os.listdir, and use the SSIS module to get Python version and command line arguments.
Create a custom Python module with two functions, import it into a second script, call greet and add, pass arguments, and return results to the caller.
Explore Python packages as organized directories of related modules, including built-in and user-defined ones, enabling reusable components, easier maintenance, and collaboration by grouping functions and classes into a project-friendly toolbox.
Explore how a package is a directory containing multiple modules and an __init__.py file, and how to structure subpackages for deeper organization.
Discover how packages improve code organization through modularity and namespaces, creating reusable modules across projects. See how modules and submodules prevent conflicts and enable code reuse in devops workflows.
Create a Python package with an __init__.py and two modules: math_operations for add and subtract, and string_operations for upper and lower.
Learn to structure a Python package with an __init__.py file, expose functions from modules like math_operations and string_operations, and import them with from module import function to use in scripts.
Import the package from main.py placed beside the package directory, call the add and subtract functions from its modules, and print the results to show eight for both operations.
Import and use functions from a package to perform string case conversions with result_upper and result_lower in a main.py script, printing the uppercase hello and lowercase world outputs.
Python for DevOps means using Python to make DevOps tasks easier and more efficient. DevOps is all about automating tasks like building, testing, and deploying software quickly, as well as managing servers and infrastructure.
Python is great for this because it’s simple to learn, and it has many tools and libraries that help automate these tasks.
For example, you can use Python to automatically create servers, manage cloud services, and set up continuous integration and delivery (CI/CD) pipelines. Python helps DevOps teams work faster and more effectively by reducing manual work and making processes smoother.
Course Outline:
Section1: Introduction
-> Introduction
-> An overview of Python
-> About Shell Scripting
-> Python vs. Shell Scripting
-> When to Use Python vs. Shell Scripting
Section2: How to Begin Practicing Python Coding
-> Begin Python Coding Practice
-> Visual Studio Code - Python Coding Practice
-> PyCharm - IDEs
-> Codespaces - Online Coding Platform
Section3: Python Data Types
-> About Data Types in Python
-> Lab - String Data Type
-> Lab - Integer Data Type
-> Lab - Float Data Type
-> Lab - len(), Length of a string
-> Lab - String upper(), lower()
-> Lab - String replace()
-> Lab - String split()
-> Lab - Print specific object in split()
-> About List in Python
-> Lab - List Data Type
-> Lab - Add and Modify in a List Data Type (Mutable)
-> About Tuples in Python
-> Lab - Tuples in Python
-> About Sets in Python
-> Lab - Sets in Python
-> Dictionary in Python
-> Lab - Dictionary in Python
-> Use Cases in DevOps
-> Boolean Data Types
-> Lab - Boolean in Python
-> Coding Exercise 1:Create a Python script to add two integers
-> Coding Exercise 2:Create a python script to perform operation of floating-point
-> Coding Exercise 3:Write a python script to determine the length of a string
-> Coding Exercise 4:Create a python script to convert a string to uppercase and lowercase
-> Coding Exercise 5:Create a Simple python Script to replace a substring within a string
-> Coding Exercise 6:Create a Simple python script to Split the text of a string
-> Coding Exercise 7:Create a python script to define a Variable and assign it a list of five integers
Section4: Regular Expression (regex) in Python
-> Overview of Regular Expressions in Python
-> Lab - Using re. match() to Match Patterns at the Start of a String
-> Lab - Using re. search() to Find Matches Anywhere in a String
-> Lab - Using re. findall() to Search for All Matches in a String
-> Regex Use Cases from a DevOps Perspective
-> Coding Exercise
Section5: Mastering Keywords in Python
-> Overview of Keywords in Python
-> Common Python keywords
-> Mastering Control Flow Keywords - if, else, for, and break
-> Lab: Mastering Control Flow Keywords - continue, def, return, class, import etc.
Section6: Working with Variables in Python
-> Overview of Variables with Example
-> Lab: Working with Float Variables in Python
-> Lab: Defining Lists as Variables in Python
-> Lab: Working with Dictionary Variables in Python
-> Python Variables: Local vs Global Scope
-> Lab: Working with Local Variables in Python
-> Lab: Working with Global Variables in Python
Section7: Return Statement in Python
-> Return Statement: An Overview with Syntax
-> Lab: Creating Functions That Return Values
-> Lab: Functions That Return Multiple Values
-> Lab: Function for Identifying Even and Odd Values
Section8: Python Functions: Definition and Usage
-> Introduction to Functions in Python
-> Advantages of functions in Python
-> Lab: Functions with Parameters
-> Lab: Functions with Return Value
-> Lab: Designing Functions for Basic Arithmetic Operations
-> Comparing Scripts: Using Functions vs. Not Using Functions
Section9: Utilizing Modules in Function Design
-> Introduction to Python Modules
-> An Overview of Built-in Modules
-> An Overview of User-defined Modules
-> Lab: Essential Built-in Modules in Python
-> Lab: OS and Math Modules
-> Lab: Building Your Own Modules
Section 10: Python Packages: Organizing Your Code
-> Introduction to Python Packages
-> Key Concepts of Packages
-> Advantages of Using Packages
-> Lab: Creating Package Structures and Modules
-> Importing Modules for Easier Access using __init__. py
-> Creating a Main Python File to Utilize Your Package
-> Importing Functions from a Package
Section 11: Command Line Arguments in Python
-> Command Line Arguments with Practical Examples
-> Lab: Script to Add Two Numbers (No Command Line Arguments)
-> Lab: Working with sys. argv for Command Line Arguments
-> Lab: Passing Multiple Arguments to Python Scripts
-> Lab: Pass Arguments to Add Two Numbers
-> Lab: Conditional Arithmetic via Script Arguments
-> Lab: Conditional Arithmetic Using Script Arguments
Section 12: Operators in Python: Concepts and Examples
-> The Basics of Arithmetic Operators in Python
-> Lab: Exploring Comparison (Relational) Operators
-> Lab: Comparison Operators (=, >, >=, ==)
-> Logical Operators: and, or, not
-> Lab: Using 'and' , 'or' for Logical Operations
-> Lab: Using 'not' for Logical Operations
-> Assignment Operators in Python
-> Lab: Understanding Different Assignment Operators
-> Membership Operators: 'in' and 'not in'
-> Lab: Using 'not in' Membership Operators
-> Operators in DevOps: Practical Use Cases
-> Use Cases for Operators in the DevOps Workflow
Section 13: Conditional Statements in Python
-> Understanding 'if' statement in Python
-> Understanding 'else'..'elif' statement in Python
-> Lab: Implementing if..else Statements
-> Lab: DevOps Use Cases with if..else..elif
Section 14: Understanding Loops in Python
-> For Loops in Python: Syntax and Usage
-> While Loops in Python: Syntax and Usage
-> Lab: Implementing For Loops
-> Lab: Printing Ranges and Strings with For Loops
-> Lab: Implementing Infinite While Loops
-> Lab: Exploring Break Statements in Python
Section 15: Real-time Use Case: Lists and Exception Handling in Python
-> Introduction to the Real-Time Project
-> Lab: User Input for List Creation
-> Lab: Understanding split function text.split()
-> Lab: Identify modules and their functions
-> Lab: Utilize a for loop to list files
-> Exception Handling with Try Statement
-> Lab: Python Script for Handling Exceptions Using Try Statements
-> Lab: Handling Error - FileNotFoundError
-> Lab: Handling Known Error - PermissionError
Section 16: Integrating Python with GitHub
-> Integrating Python with GitHub Through the GitHub API
-> Lab: Install PyGithub and Generate a GitHub Access Token
-> Lab: Retrieve User Login and Public Repos with Python
-> Lab: Retrieve GitHub Account Repository List
-> Lab: Create a New Repository with Python
Section 17: Cloning a GitHub Repository with Python
-> Clone a Repository Using the Subprocess Module
-> Lab: Clone a Repository with the Subprocess Module
-> Lab: Using GitPython Library
-> Lab: Handle Git Errors with Exception Handling
Section 18: Boto3 Python Module
-> Introduction to the Boto3 Python Module
-> Lab: Install Boto3 and Create an AWS User Account
-> Lab: Configure GitHub Access from Codespaces via AWS CLI
-> Lab: List All Buckets with Boto3-1
-> Lab: List All Buckets with Boto3-2
-> Lab: List All Buckets with Boto3-3
-> Lab: Upload a File to a Bucket Using Boto3
-> Lab: Download a File to a Bucket Using Boto3
Section 19: Launching an EC2 Instance using Boto3 Python Module
-> Project Overview
-> Setting Up a User Account in AWS with IAM
-> Set Up AWS CLI in Codespaces
-> Begin Python Script: Import Boto3
-> Include EC2 Attributes in Python Script
-> Add Tag Specifications in Python Script
-> Debug the Python Script Before Execution
-> Access the EC2 Instance Launched via Python Script
-> Update the Python Script to Add 20GB EBS Volume
-> Run Python Script to Confirm EBS Volume
-> Update Python Script to Include UserData
-> Update Python Script to Include Apache Package
-> Run the Revised Python Script and Validate
-> Access the Apache Server
Section 20: CI/CD Automation with Jenkins and Python
-> Project Overview
-> Set Up a GitHub Repository for Your Project
-> Write the Source Code in Python and Push to GitHub Repository
-> Provision a Jenkins Server Instance in AWS
-> Connect to the Jenkins Server and Install Java
-> Install the Jenkins Package on the Server
-> Set Up Jenkins Configuration
-> Install Necessary Plugins on the Jenkins Server
-> Add GitHub Credentials to the Jenkins Server
-> First Stage of the Pipeline: Checkout the Project
-> Build the Job
-> Add a Stage for Installing Python Dependencies
-> Add a Stage to Execute the Python Script
-> Setting Up a User Account in AWS with IAM
-> Create Access Keys for Jenkins Credentials
-> Set Up Access Keys in Jenkins Pipeline
-> Export AWS Credentials in Jenkins Pipeline
-> Build the Job and Verify EC2 Instance Creation in AWS
-> Access the Web Server Using URL
Section 21: Integrate GitHub Webhooks With Jenkins
-> Setup GitHub Webhooks in Jenkins
-> GitHub hook trigger for GITScm polling
-> Add Jenkins Webhook to GitHub Repository
-> Test the Webhook by Editing the Python Script
Section 22: Develop Games with Python using PyCharm and ChatGPT