Sumana Challa has Published 36 Articles

Get similar words suggestion using Enchant in Python

Sumana Challa

Sumana Challa

Updated on 11-Jun-2025 14:57:14

390 Views

There will be times when we misspell some words when we write something. To overcome this problem, we use the PyEnchant module in Python. This module is used to check the spelling of words and suggest corrections that are misspelled words. It is also used in many popular tasks, including ... Read More

Minkowski distance in Python

Sumana Challa

Sumana Challa

Updated on 11-Jun-2025 14:47:47

2K+ Views

Minkowski distance is a metric in a normed vector space that measures the distance between two or more vectors. This is typically used in machine learning to find distance similarity. The formula to calculate the Minkowski distance is - $$\mathrm{D= \big[\sum_{i=1}^{n}|r_i-s_i|^p\big]^{1/p}}$$ Where, xi and yi: ... Read More

Python program to convert floating to binary

Sumana Challa

Sumana Challa

Updated on 09-Jun-2025 14:26:50

3K+ Views

Floating number is a number that has a decimal point and can represent both large and very small values. Binary number is a number expressed in the base-2 numeral system, using 0's and 1's. The conversion of floating-point number to binary representation in Python requires to represent the number in ... Read More

Break a list into chunks of size N in Python

Sumana Challa

Sumana Challa

Updated on 09-Jun-2025 14:25:31

592 Views

The objective is to break a list into chunks of a specific size (n), that is, splitting a list into sublists where each sublist contains n elements. For example, if the list is [12, 33, 11, 56, 44, 89, 23, 34, 12] and the chunk size is 3. Then the ... Read More

Python program to find common elements in three lists using sets

Sumana Challa

Sumana Challa

Updated on 09-Jun-2025 13:49:15

1K+ Views

List is one of the built-in data types in Python, which is a sequence of comma-separated items, enclosed in square brackets [ ]. For example, consider the following lists as input - list1 = [5, 10, 15, 20, 25] list2 = [2, 5, 6, 7, 10, 15, 18, 20] list3 ... Read More

How to create a duplicate file of an existing file using Python?

Sumana Challa

Sumana Challa

Updated on 05-Jun-2025 14:05:24

1K+ Views

In Python, duplicates of an existing file are created as backups to manipulate data and to preserve original version. To create a duplicate file of an existing file using Python we can use the shutil module or pathlib module, which we will discuss in detail with examples. Here are the ... Read More

How to create a unique temporary file name using Python?

Sumana Challa

Sumana Challa

Updated on 05-Jun-2025 14:01:26

926 Views

Temporary files are created to store data temporarily during the execution of a program or while working with large amount of data. To create a temporary file we can use the tempfile module, as it creates unique names and stores in platform-dependent default location . Specifically the tempfile module is ... Read More

How to calculate catalan numbers with the method of Binominal Coefficients using Python?

Sumana Challa

Sumana Challa

Updated on 05-Jun-2025 13:56:50

226 Views

Catalan numbers are defined as a sequence of natural numbers that can be used to find the number of possibilities of various combinations. The below formula is used to calculate catalan number using the binomial coefficient ( denoted as (nk) and represents the number of ways to choose k items ... Read More

Python program to right rotate a list by n

Sumana Challa

Sumana Challa

Updated on 05-Jun-2025 13:52:02

2K+ Views

In this article, we will discuss different methods used to right rotate a list from the given rotation number. A list has comma-separated values (items) of same type or different type between square brackets. To right rotate a list by n, Python offers many ways such as using slicing, ... Read More

What is the difference between os.open() and os.fdopen() in Python?

Sumana Challa

Sumana Challa

Updated on 28-May-2025 19:57:42

1K+ Views

The open() function is a built-in Python function that helps you work with files, however, the os module offers low-level file handling functions that give more control over how files are opened and managed, two of such function from the os module are os.open() and os.fdopen(). The key difference between both ... Read More

Advertisements