Posts

Showing posts with the label python

Python Fundamentals – Practical Exercise 5: Building a Cloud Resource Monitor Simulator

1. Introduction Welcome to the fifth practical exercise in our Python Fundamentals series! In our previous exercises, we developed a Class Grades Summary Calculator, a Shopping Cart Total Calculator, an Inventory Management System, and a Simple Network Scanner. This time, we'll apply our Python knowledge to a cloud computing scenario by building a Cloud Resource Monitor Simulator . Cloud environments commonly use virtual machines (VMs) to run applications, services, and workloads. Monitoring their resource consumption is important for identifying performance issues and understanding how infrastructure resources are being utilized. In this exercise, we'll simulate monitoring multiple virtual machines by collecting their CPU, memory, and storage usage percentages. Our program will organize the collected information using dictionaries, convert input values into integers, identify high resource utilization, and calculate average usage across all virtual machines. The objective is t...

Python Fundamentals – Practical Exercise 4: Building a Simple Network Scanner

1. Introduction Welcome to the fourth practical exercise in our Python Fundamentals series! In our previous exercises, we developed a Class Grades Summary Calculator, a Shopping Cart Total Calculator, and an Inventory Management System. This time, we'll apply our Python knowledge to a cybersecurity-related scenario: building a Simple Network Scanner . Network scanning is a common activity in cybersecurity used to identify devices and hosts within a network. In this exercise, we'll create a simulated network scanner that accepts an IP address range, generates a list of IP addresses, and randomly determines whether each host is active or inactive. The objective is to practice working with IP addresses, lists, dictionaries, loops, conditions, functions, and type casting. Important: This exercise simulates network scanning. It does not send actual network packets or verify whether devices are reachable. 2. Exercise Requirements We need to develop a program that performs the follow...

Python Fundamentals – Practical Exercise 3: Building an Inventory Management System

1. Introduction Welcome to the third practical exercise in our Python Fundamentals series! In the previous exercises, we developed a Class Grades Summary Calculator and a Shopping Cart Total Calculator using functions, loops, lists, and conditional statements. This time, we'll build a simple Inventory Management System . An inventory management system helps organize products and maintain information about available stock, including product prices and quantities. Our program will use Python dictionaries to store product information and functions with variable-length arguments to add, update, and calculate inventory values. The objective is to understand how *args and **kwargs work in practical applications while improving our ability to organize and process structured data. 2. Exercise Requirements We need to develop a program that performs the following tasks: 1. Create an inventory dictionary Store products and their details, including price and quantity. 2. Create an add_produc...

Python Fundamentals – Practical Exercise 2: Building a Shopping Cart Total Calculator

1. Introduction Welcome to the second practical exercise in our Python Fundamentals series! In our previous exercise, we developed a Class Grades Summary Calculator using functions, lists, loops, and conditional statements. This time, we'll apply these concepts to a different real-world scenario: building a Shopping Cart Total Calculator . Our program will collect information about items being purchased, calculate the total price based on their quantities, apply discounts when applicable, and generate a summary of the shopping cart. The objective is to understand how Python functions, loops, lists, and conditional logic can work together to solve a practical programming problem. 2. Exercise Requirements We need to develop a program that performs the following tasks: Ask the user for the number of items they want to purchase. For each item: Ask for the item's name. Ask for its price. Ask for the desired quantity. Create two functions: Calculate the total price of an item. Apply ...

Python Fundamentals – Practical Exercise 1: Building a Class Grades Summary Calculator

1. Introduction Welcome to the first practical exercise in our Python Fundamentals series! Throughout the previous tutorials, we've explored essential Python concepts, including variables, data types, functions, lists, loops, conditional statements, and string formatting. Now it's time to put these concepts together to solve a practical programming problem. In this exercise, we'll build a Class Grades Summary Calculator that collects student information, calculates their average marks, assigns grades, and displays the results in a formatted table. The objective is to understand how different Python concepts work together when developing a complete program. 2. Exercise Requirements We need to develop a program that performs the following tasks: Ask the user to enter the number of students in the class. For each student: Ask for the student's name. Request three marks individually. Store the marks in a list. Calculate the student's average using a function. Determine...

Python Fundamentals – Level 4: Tuples, Sets, Copying, Iteration & Advanced Python Features

Python Fundamentals – Level 4: Tuples, Sets, Copying, Iteration & Advanced Python Features Python for Cybersecurity Tutorial Series Welcome to Level 4 of the Python Fundamentals series! In Level 3, we explored string methods, function parameter types, lists, list comprehension, nested lists, and dictionaries. In this tutorial, we'll expand our understanding of Python data structures and explore some additional language features. We'll cover dictionary iteration, tuples, copying mutable objects, stacks, sets, slicing, enumeration, pattern matching, the walrus operator, and the Ellipsis value. These concepts will help you write more efficient, organized, and flexible Python programs, especially when working with structured information and automation. 1. Iterating Through a Dictionary In Python, dictionaries store information as key-value pairs. There are several ways to iterate through a dictionary depending on whether we need its keys, values, or both. Let's start with a...