Articles on Trending Technologies

Technical articles with clear explanations and examples

Python Program to print unique values from a list

Sarika Singh
Sarika Singh
Updated on 24-Mar-2026 3K+ Views

List is a built-in data structure in python which functions like a dynamically sized array. Lists are created by putting elements in square brackets [element1, element2, ....]. Elements present in list are indexed and the indexing starts from [0]. List has the following properties − List is mutable meaning that elements can be added, removed or changed from a list after its creation. List is ordered, so adding new elements to the list ...

Read More

Python program to sort a tuple by its float element

Sarika Singh
Sarika Singh
Updated on 24-Mar-2026 2K+ Views

This article demonstrates how to sort a list of tuples by their float elements in Python. We'll explore three different approaches: using sorted(), using sort(), and implementing bubble sort manually. Input-Output Scenarios The following scenarios show how tuples are sorted by their float elements in descending order ? Scenario 1 Input: data = [('Dengue', '54.865'), ('Malaria', '345.743'), ('Corona', '456.864'), ('Typhoid', '35.285'), ('Jaundice', '83.367')] Output: [('Corona', '456.864'), ('Malaria', '345.743'), ('Jaundice', '83.367'), ('Dengue', '54.865'), ('Typhoid', '35.285')] Scenario 2 Input: data = [('638', '54.865'), ('932', '345.743'), ('256', '456.864'), ('843', '35.285'), ('246', '83.367')] Output: [('256', ...

Read More

Python Program to find mirror characters in a string

Sarika Singh
Sarika Singh
Updated on 24-Mar-2026 3K+ Views

This article teaches you how to write a Python program to find mirror characters in a string. A mirror character is the alphabetically opposite character − 'a' mirrors to 'z', 'b' to 'y', and so on. Understanding Mirror Characters Mirror characters are pairs of letters that are equidistant from both ends of the alphabet. For example: 'a' (1st letter) mirrors to 'z' (26th letter) 'b' (2nd letter) mirrors to 'y' (25th letter) 'c' (3rd letter) mirrors to 'x' (24th letter) Input-Output Example Given a string and a position, we mirror characters from that ...

Read More

Python Program to check if two given matrices are identical

Sarika Singh
Sarika Singh
Updated on 24-Mar-2026 4K+ Views

Matrix refers to a collection of numbers arranged in rows and columns to form a rectangular array. The numbers make up the matrix's entries, or elements. We need to create a Python function to determine whether two given matrices are identical. In other words, we say that two matrices are identical if all of the elements in their respective places are the same. Identical Matrices Two matrices are only considered equal if and when they meet the requirements listed below − There should be an equal number of rows and columns ...

Read More

Create Word Cloud using Python

Akshitha Mote
Akshitha Mote
Updated on 24-Mar-2026 2K+ Views

A word cloud is a visual representation of text data, where the size of each word indicates its frequency or importance within the dataset. It helps us to identify the most common and important words in a text. It is typically used to describe/denote big data in a word. In this article, we will create a word cloud on the Python programming language, and the data is accessed from Wikipedia. Required Modules Following are the modules required to create a word cloud in Python − Install wordcloud Before installing the word cloud module, you have ...

Read More

How to convert HTML to PDF using Python

Akshitha Mote
Akshitha Mote
Updated on 24-Mar-2026 2K+ Views

Converting HTML to PDF programmatically is a common requirement for generating reports, invoices, or documentation. Python provides several libraries for this task, with pdfkit being one of the most popular options as it leverages the powerful wkhtmltopdf engine. In this article, we will explore how to convert HTML files to PDF using Python with the pdfkit library. Prerequisites and Installation Step 1: Install pdfkit Library First, install the pdfkit library using pip − pip install pdfkit Step 2: Install wkhtmltopdf The pdfkit library requires wkhtmltopdf as its backend engine. Follow these ...

Read More

Python program to sort a list according to the second element in the sublist.

AmitDiwan
AmitDiwan
Updated on 24-Mar-2026 2K+ Views

In this article, we will learn how to sort a list according to the second element in each sublist. This is useful when working with data where each item is a pair, such as name-score pairs or key-value combinations. Let's say we have the following list ? [['jack', 50], ['antony', 20], ['jones', 87], ['gary', 70], ['tom', 90], ['sam', 110], ['warner', 65]] The output should be sorted according to the second element ? [['antony', 20], ['jack', 50], ['warner', 65], ['gary', 70], ['jones', 87], ['tom', 90], ['sam', 110]] Using sort() Method The ...

Read More

Python program to calculate BMI(Body Mass Index) of your Body

karthikeya Boyini
karthikeya Boyini
Updated on 24-Mar-2026 1K+ Views

Body Mass Index (BMI) is a measure used to determine whether a person has a healthy body weight for their height. The BMI formula is: BMI = weight (kg) / height² (m²). Algorithm Step 1: Input height in meters and weight in kilograms Step 2: Apply the BMI formula: weight / (height × height) Step 3: Display the calculated BMI value Step 4: Interpret the BMI category Basic BMI Calculator Here's a simple program to calculate BMI − height = float(input("Enter your height (m): ")) weight = float(input("Enter your weight (kg): ")) ...

Read More

Python program multiplication of two matrix.

Samual Sam
Samual Sam
Updated on 24-Mar-2026 20K+ Views

Matrix multiplication is a fundamental operation in linear algebra where we multiply two matrices to produce a resultant matrix. In Python, we can implement matrix multiplication using nested loops and list comprehensions. Algorithm Step 1: Input two matrices of compatible dimensions Step 2: Initialize a result matrix with zeros Step 3: Use three nested loops: - Outer loop for rows of first matrix - Middle loop for columns of second matrix - Inner loop for dot product calculation Step 4: For each position (i, j), multiply ...

Read More

Python program for Modular Exponentiation

Akshitha Mote
Akshitha Mote
Updated on 24-Mar-2026 1K+ Views

Modular exponentiation calculates (baseexponent) % modulo efficiently. This operation is fundamental in cryptography and number theory, involving three integers: base, exponent, and modulo. Syntax # Basic syntax result = (base ** exponent) % modulo # Using pow() function (recommended) result = pow(base, exponent, modulo) Basic Example Let's calculate (25) % 5 step by step ? base = 2 exponent = 5 modulo = 5 # Step by step calculation power_result = base ** exponent print(f"{base}^{exponent} = {power_result}") final_result = power_result % modulo print(f"{power_result} % {modulo} = {final_result}") ...

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