Posts

Showing posts from May, 2026

Exception Handling in Python — A DevOps Engineer’s Real-Life Perspective

Image
Today I’m going to discuss Exception Handling in Python from a DevOps engineer’s point of view. What is Exception Handling? Before understanding exception handling, let’s first understand what an exception is. An exception is an error that occurs during program execution. If the error is not handled properly, the program stops immediately. As DevOps engineers, we deal with systems, automation, scripts, servers, cloud platforms, CI/CD pipelines, and monitoring tools daily. Because of this, errors and bugs are very common in our routine work. Sometimes the issue is fixed by developers because they have deep knowledge of the application code. But from the DevOps side, we often need to handle the error properly so the automation or service does not completely fail. This process is called Exception Handling . Why Do We Use Exception Handling? There are mainly two ways to deal with errors: Fix the actual error Handle the error gracefully using exception handling In exception handling, we ...

Real-Time Python Interview Experience - Count Duplicate Values from a List

Image
 Today I’m going to share a real-time interview experience that really improved my logical thinking as a DevOps engineer. During the interview, I was given a small Python task that looked simple at first, but it was actually a good brainstorming challenge. The task was to convert a list into a dictionary and count how many times each car name appeared. Interview Task cars = [ "audi" , "audi" , "audi" , "bmw" , "Jaguar" , "jaguar" ] The expected output was: { 'audi' : 3, 'bmw' : 1, 'jaguar' : 2} At first, this task was a little confusing for me because I needed to understand how counting logic works in Python dictionaries. But after practicing the logic step by step, I solved it successfully. Step-by-Step Solution cars = [ "audi" , "audi" , "audi" , "bmw" , "Jaguar" , "jaguar" ] final_car_count = {} for car in cars: # Convert all values in...

Bubble Sort Algorithm Explained in Easy Way

Image
 Today I’m going to discuss one of the most famous sorting techniques in programming called Bubble Sort . As a DevOps engineer, understanding algorithms is also important because automation and scripting become easier when your logic building is strong. Bubble Sort is a simple algorithm that sorts numbers step by step by comparing values with each other and swapping them when needed. Let’s understand it in a very easy way. What is Bubble Sort? Bubble Sort is a sorting technique that compares two values again and again and places the smaller value before the bigger value. The process keeps repeating until the complete list becomes sorted. For example: [-2, -1, 0, 1, 1, 2, 3, 4, 5, 56, 89] This is called ascending order because numbers are arranged from smaller to larger. Bubble Sort Code Example list_of_num = [ 1 , 1 , 2 , 3 ,- 1 , 4 ,- 2 , 0 , 56 , 89 , 5 ] for i in range(len(list_of_num)): for j in range(len(list_of_num)): if list_of_num[i] < list_of_num[j]: ...