Akshitha Mote

Akshitha Mote

35 Articles Published

Articles by Akshitha Mote

35 articles

How to Create Acronyms from Words Using Python

Akshitha Mote
Akshitha Mote
Updated on 27-Mar-2026 4K+ Views

An acronym is an abbreviated version of a phrase formed by taking the first character of each word. For example, "CPU" is an acronym for "Central Processing Unit". In this article, we will learn different methods to create acronyms from words using Python. Example Scenario Input: "Automatic Teller Machine" Output: "ATM" Explanation: The acronym is created by taking the first character of each word: A-T-M. Algorithm to Create Acronyms The following steps create acronyms from words using Python − Split the input string into individual words using split() ...

Read More

Python program to find factorial of a large number

Akshitha Mote
Akshitha Mote
Updated on 26-Mar-2026 930 Views

Before going to the solution let's understand about factorial. The factorial is a product of all the integers smaller than or equal to n. The mathematical representation is n! = n × (n-1) × (n-2) × ... × 1. For example, 4! = 4 × 3 × 2 × 1 = 24. In this article, let's explore different ways to find the factorial of a large number in Python. Various Methods Following are multiple ways to find the factorial of a large number in Python − Using 'math' Module ...

Read More

Python program to capitalize each word\'s first letter

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

Let's understand the problem statement: we need to convert a given string to a title case, which involves capitalizing the first letter of each word while converting the remaining letters to lowercase. The following are the various ways to capitalize each word's first letter in a string ? Using title() method Using capitalize() method Using upper() method Importing string module Importing regex module Capitalizing a String in a File Using the title() ...

Read More

Python Program to Print an Inverted Star Pattern

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

In this article, we'll learn how to print inverted star patterns in Python. An inverted star pattern displays stars in descending order, where each row has fewer stars than the previous one. For example, with N=5 rows ? ***** **** *** ** * Basic Inverted Star Pattern The most common approach uses nested for loops − the outer loop controls rows, and the inner loop prints stars for each row. Using Nested Loops Here's how to create an inverted star pattern with spaces between stars ? # Number of rows N ...

Read More

Python - Replace duplicate Occurrence in String

Akshitha Mote
Akshitha Mote
Updated on 25-Mar-2026 920 Views

In this article, we will explore different ways to replace duplicate occurrences in a string. Before understanding the solution let's try to understand the problem statement with an example. Consider a string "Ram lives in Hyderabad. Ram is studying in class 10. Ram is the class Monitor of the class." In this string "Ram" appears multiple times we need to replace the duplicate occurrences with 'He', keeping the first occurrence unchanged. Methods to Replace Duplicate Occurrences Following are the multiple ways to replace duplicate occurrences in a string − Using List comprehension Using for loop ...

Read More

Check whether product of \'n\' numbers is even or odd in Python

Akshitha Mote
Akshitha Mote
Updated on 25-Mar-2026 692 Views

In this article, we explore different methods to check whether the product of n numbers is even or odd. A number that is divisible by 2 is known as an even number, otherwise it is an odd number. For example, 14 and 12 are two even numbers, their product 168 is even. Numbers 9 and 5 are odd, their product 45 is odd. Consider one even number 2 and one odd number 3 − their product 6 is even. Mathematical Facts Understanding these mathematical rules helps us determine if a product is even or odd − ...

Read More

Accumulator battery in Python

Akshitha Mote
Akshitha Mote
Updated on 25-Mar-2026 402 Views

Consider a mobile phone in eco mode that activates when battery level reaches 20%. In eco mode, the battery drains two times slower than normal mode. Given the current time t and battery percentage p, we need to calculate how many minutes remain until the phone turns off. Problem Statement In normal mode, if the battery drains 1% per minute, then in eco mode it drains 1% per 2 minutes (half the rate). Starting with 100% battery, after t minutes we have p percent remaining. We must find the time until complete drain. Example Scenario If ...

Read More

Unique Number of Occurrences in Python

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

Suppose we have an array, and we need to check whether each element has a unique number of occurrences. If no such element exists, we return false; otherwise, we return true. For example, given the array [1, 1, 2, 2, 2, 3, 4, 4, 4, 4], the function will return true because no two elements have the same number of occurrences: 1 occurs twice, 2 occurs three times, 3 occurs once, and 4 occurs four times. Using Dictionary to Track Occurrences A dictionary is ideal for counting occurrences since it stores key-value pairs where keys are unique elements ...

Read More

Check for balanced parentheses in Python

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

In this article, we will solve the problem of checking balanced parentheses. A string has balanced parentheses when every opening bracket has a corresponding closing bracket in the correct order. The following are the conditions for balanced parentheses − Every opening parenthesis has a corresponding closing parentheses. Parentheses should be closed in the correct order. For example, "{[()]}" is a balanced parenthesis. Consider the same example with different arrangement "{([})]" which is unbalanced parentheses. Using List and For Loop The stack-based approach uses a list to ...

Read More

Python3 - Why loop doesn't work?

Akshitha Mote
Akshitha Mote
Updated on 25-Mar-2026 315 Views

In Python, using loops, we can execute a statement or a group of statements multiple times. Usually, the loop works for all conditions, but there are certain scenarios where the functionality of loops appears to be "not working" due to delays, skipping iterations, or getting stuck in infinite loops. In this article, we will understand those scenarios with examples. When sleep() Method is Used Inside Loop The sleep() method is defined in the time module and used to suspend or stop the execution of the program for a specified number of seconds. When the sleep() method ...

Read More
Showing 1–10 of 35 articles
« Prev 1 2 3 4 Next »
Advertisements