Sumana Challa has Published 36 Articles

How to change the owner of a file using Python?

Sumana Challa

Sumana Challa

Updated on 28-May-2025 19:54:11

1K+ Views

Changing the ownership of a file is to transfer the file's ownership from one user to another. This is mainly to specify who has control over modifying, deleting, or setting permissions for the file. Before you change the ownership of a file, make sure you have administrative privileges, and the ... Read More

How to open a binary file in read and write mode with Python?

Sumana Challa

Sumana Challa

Updated on 28-May-2025 19:23:01

2K+ Views

Binary file is a file that consists of a series of 1's and 0's. This is typically used to represent data such as images, audio, video, etc. To open the binary files in read and write mode, Python provides an in-built function, which is the open() function. The open() Function  The ... Read More

How to multiply large numbers using Python?

Sumana Challa

Sumana Challa

Updated on 28-May-2025 19:11:48

3K+ Views

You can multiply large numbers in Python directly without worrying about speed. Python supports a "bignum" integer type which can work with arbitrarily large numbers. In Python 2.5+, this type is called long and is separate from the int type, but the interpreter will automatically use whichever is more appropriate. ... Read More

How to divide large numbers using Python?

Sumana Challa

Sumana Challa

Updated on 28-May-2025 15:25:14

1K+ Views

Python allows you to perform the basic mathematical operations like addition, subtraction, multiplication, and division on large numbers as Python's integers are arbitrary-precision, hence there is no limit on their size.You can divide large numbers as you would normally do. But this has a lot of precision issues as such ... Read More

How can I create a directory if it does not exist using Python?

Sumana Challa

Sumana Challa

Updated on 28-May-2025 14:08:21

301K+ Views

Python has built-in file creation, writing, and reading capabilities. In Python, there are two sorts of files that can be handled: text files and binary files (written in binary language, 0s, and 1s). While you can create files, you may delete them when you no longer need them. We can ... Read More

How to print Narcissistic(Armstrong) Numbers with Python?

Sumana Challa

Sumana Challa

Updated on 16-May-2025 19:37:20

448 Views

A narcissistic number (also known as an Armstrong number) is a number that equals the sum of its digits, each raised to the power of the number of digits. For example, 370 - 33+73+03 = 370. The algorithm to check for an Armstrong number is as follows - ... Read More

What are .pyc files in Python?

Sumana Challa

Sumana Challa

Updated on 15-May-2025 19:56:59

40K+ Views

We usually write programs in Python and save the file with .py extension. However, there is another file type called .pyc,  which is automatically generated by the Python interpreter while executing the source code. What is a .pyc File? When you execute a Python program, the Python interpreter doesn't directly ... Read More

Find all the patterns of \"10+1\" in a given string using Python Regex

Sumana Challa

Sumana Challa

Updated on 09-May-2025 12:17:34

214 Views

The term "10plus1" is a specific pattern in a binary string that starts with a digit '1' followed by at least one or more '0' and ending with a '1'. In regular expressions this pattern is represented as - 10+ 1 Using re.findall() The re.findall() method accepts a pattern ... Read More

How to bitwise XOR of hex numbers in Python?

Sumana Challa

Sumana Challa

Updated on 09-May-2025 10:44:12

3K+ Views

The bitwise XOR is a binary operation in which we compare two binary numbers bit by bit and return the value "1" if the bits are not same, and 0 if they are the same. The XOR(exclusive OR) operation follows the below rules - ... Read More

How can I remove the same element in the list by Python

Sumana Challa

Sumana Challa

Updated on 09-May-2025 10:30:40

2K+ Views

A list is a built-in Python data structure that is used to store an ordered collection of items of different data types. It often occurs that lists contain duplicate values, i.e., the same element repeating multiple times, which causes data inaccuracies. In this article, we will discuss the approaches that ... Read More

Advertisements