Articles on Trending Technologies

Technical articles with clear explanations and examples

Python program to convert Dict of list to CSV

Gireesha Devara
Gireesha Devara
Updated on 27-Mar-2026 2K+ Views

A dictionary of lists is a common data structure where each key maps to a list of values. Converting this structure to CSV format is useful for data analysis and sharing tabular data. Here's an example of a dictionary of lists ? data = { 'numbers': [1, 2, 3, 4, 5, 6], 'states': ['UP', 'Tamil Nadu', 'Telangana', 'Gujarat', 'UP', 'Tamil Nadu'], 'cities': ['Agra', 'Chennai', 'Hyderabad', 'Surat', 'Lucknow', 'Coimbatore'] } print(data) {'numbers': [1, 2, 3, 4, 5, 6], 'states': ['UP', 'Tamil Nadu', 'Telangana', ...

Read More

Finding the Maximum and Minimum in a Python set

Dr Ruqaiya Khanam
Dr Ruqaiya Khanam
Updated on 27-Mar-2026 9K+ Views

Python sets store unique elements in an unordered collection. To find the maximum and minimum values in a set, Python provides several approaches using built-in functions like max(), min(), and sorted(). Using Built-in max() and min() Functions The most direct approach is to apply max() and min() functions directly to the set ? # Define a set with integer values numbers = {5, 2, 8, 1, 9, 18} # Find maximum and minimum values directly maximum = max(numbers) minimum = min(numbers) print("Maximum:", maximum) print("Minimum:", minimum) Maximum: 18 Minimum: 1 ...

Read More

Python program to find volume, surface area and space diagonal of a cuboid

Dr Ruqaiya Khanam
Dr Ruqaiya Khanam
Updated on 27-Mar-2026 4K+ Views

In this article, we will discuss how to compute the volume, surface area, and space diagonal of a cuboid. A cuboid is a 3D geometric shape that resembles a rectangular box, also called a rectangular prism. It has six rectangular faces with twelve edges, where length, breadth, and height are different (unlike a cube where all sides are equal). Understanding Cuboid Formulas Before implementing the code, let's understand the key formulas ? Volume: length × breadth × height Surface Area: 2 × (l×b + b×h + h×l) Space Diagonal: √(l² + b² + h²) ...

Read More

Python Program to get all Possible Slices of a String for K Number of Slices

Dr Ruqaiya Khanam
Dr Ruqaiya Khanam
Updated on 27-Mar-2026 183 Views

Getting all possible slices of a string for K number of slices means dividing a string into exactly K parts in all possible ways. Python provides multiple approaches to solve this problem: iteration and using itertools.combinations. Method 1: Using Iterative Approach This method builds slices iteratively by extending existing slices from previous iterations ? def get_all_slices_iteration(string, k): slices = [[]] for i in range(k): new_slices = [] ...

Read More

How to make Density Plot in Python with Altair?

Dr Ruqaiya Khanam
Dr Ruqaiya Khanam
Updated on 27-Mar-2026 462 Views

Altair is a statistical visualization library in Python based on Vega-Lite grammar. Density plots are useful for visualizing data distribution, comparing groups, and detecting outliers. This article demonstrates how to create density plots using Altair with a practical example. What is a Density Plot? A density plot shows the distribution of a continuous variable by estimating the probability density function. It's similar to a histogram but uses a smooth curve instead of bars. Required Libraries First, let's import the necessary libraries ? import altair as alt import pandas as pd Loading Sample ...

Read More

Python program to find XOR of array elements which are divisible by given number

Dr Ruqaiya Khanam
Dr Ruqaiya Khanam
Updated on 27-Mar-2026 408 Views

In this article, we will discuss how to compute the XOR of array elements that are divisible by a given number. The XOR (exclusive OR) is a binary operation that compares the bits of two operands. If the bits are different then it returns 1, whereas it returns 0 if the bits are the same. Understanding XOR Operation Let's understand XOR with a simple example using array [1, 2, 3, 4, 5] ? Initialize xor_value to 0. Begin iterating over each element: First element num = 1, perform xor_value ^ num. Since xor_value = 0, ...

Read More

Python Program to find Jumbo GCD Subarray

Dr Ruqaiya Khanam
Dr Ruqaiya Khanam
Updated on 27-Mar-2026 215 Views

The Jumbo GCD Subarray problem involves finding the Greatest Common Divisor (GCD) of a subarray with maximum possible value from a given array. The GCD is the largest positive integer that divides all numbers in a set without remainder. We can solve this using two approaches: brute force and optimized using prefix/suffix arrays. Understanding GCD Before solving the problem, let's implement a helper function to calculate GCD using the Euclidean algorithm ? def gcd(a, b): while b: a, b = b, a % b ...

Read More

Python - Rear stray character String split

Pranavnath
Pranavnath
Updated on 27-Mar-2026 199 Views

When working with strings in Python, you may encounter situations where delimiter characters appear in unexpected places, creating "stray characters" that interfere with standard string splitting operations. This article explores three effective approaches to handle string splitting when delimiters appear after certain words or in non-standard positions. What are Stray Characters in String Splitting? Stray characters are delimiters (like periods, commas, or spaces) that appear in positions where they disrupt normal string splitting patterns. For example, a period that appears immediately after a word without a following space can cause split operations to produce unexpected results. Why ...

Read More

Python – Records list XOR

Pranavnath
Pranavnath
Updated on 27-Mar-2026 1K+ Views

Python provides several methods to perform XOR (exclusive OR) operations on lists of records. XOR allows us to compare two lists and identify unique elements between them, returning elements that exist in either list but not in both. In this article, we'll explore three different approaches to applying XOR operations on lists with step-by-step implementations and examples. Understanding XOR Operation on Lists XOR (exclusive OR) is a logical operation that returns true when operands are different and false when they are the same. When applied to lists, XOR combines two lists and returns elements found in either list ...

Read More

Python – Rear Addition of Record

Pranavnath
Pranavnath
Updated on 27-Mar-2026 190 Views

In this article, we will explore three different approaches for adding records to the end of a dataset in Python. These methods provide efficient and flexible solutions for data-processing tasks. We will cover the usage of Python lists, Python's built-in deque class, and NumPy arrays. Each approach offers its own advantages, depending on factors such as performance and ease of implementation. The rear addition of a record in Python refers to the process of adding a new data entry to the end or rear of an existing dataset. It is a common operation in data-handling tasks, where new information ...

Read More
Showing 1–10 of 61,303 articles
« Prev 1 2 3 4 5 6131 Next »
Advertisements