Found 26504 Articles for Server Side Programming

Finding All substrings Frequency in String Using Python

Priya Sharma
Updated on 14-Aug-2023 12:54:48

475 Views

String manipulation and analysis are fundamental tasks in many programming scenarios. One intriguing problem within this domain is the task of finding the frequency of all substrings within a given string. This article aims to provide a comprehensive guide on efficiently accomplishing this task using the powerful Python programming language. When working with strings, it is often necessary to analyze their contents and extract valuable information. The frequency of substrings is an important metric that can reveal patterns, repetitions, or insights into the structure of the string. By determining how many times each substring appears in a given string, we ... Read More

Convert given Binary String to Another in Minimum Operations by Flipping all Bits Except any 1

Shubham Vora
Updated on 14-Aug-2023 13:39:38

705 Views

In this problem, we need to convert one binary string to another binary string by flipping the characters of the string. We can hold any set bit and flip other bits, and we need to count the total operation to achieve another string by doing it. We can solve the problem based on the total number of ‘01’ and ‘10’ pairs in the given strings. Problem statement − We have given two strings named str1 and str2 of the same length containing ‘0’ and ‘1’ characters, representing the binary string. We need to convert the string str1 to str2 by ... Read More

Finding All possible space joins in a String Using Python

Priya Sharma
Updated on 14-Aug-2023 12:47:19

194 Views

In the world of natural language processing (NLP) and text manipulation, finding all possible space joins in a string can be a valuable task. Whether you're generating permutations, exploring word combinations, or analyzing text data, being able to efficiently discover all the potential ways to join words using spaces is essential. Through this process, we'll generate all possible combinations, enabling us to explore numerous word arrangements and gain valuable insights from our text data. Problem Statement Given a string of words, we want to generate all possible combinations by inserting spaces between the words. string = "hello world". To further ... Read More

Check if the String has a Reversible Equal Substring at the Ends

Shubham Vora
Updated on 14-Aug-2023 13:38:08

126 Views

In this problem, we need to find the reversible equal substring of maximum length from the start and end of the string. The problem is very similar to finding the palindromic string. We can start traversing the string and traverse the string until characters from the start and end match. Problem statement − We have given string str containing N characters. We need to check whether the string contains the reversible equal substring at the start and end of the string. If we find the substring according to the given condition, print the longest substring. Otherwise, print ‘false’ in the ... Read More

Abbreviate given String by Replacing all Characters with Length Except the First and Last

Shubham Vora
Updated on 14-Aug-2023 13:36:13

207 Views

In this problem, we need to transform the string of a length greater than 2 into its abbreviation form. We can use the ‘length’ property of the string to count the total number of middle characters in the string, and we can first and last characters using the respected index value. Problem statement − We have given a string str of length greater than or equal to 2 and need to convert the string into its abbreviation form. The abbreviation form of the string is as shown here: first character + the total number of middle characters + last ... Read More

Converting Speech to Text to Text to Speech in Python

Priya Sharma
Updated on 14-Aug-2023 12:43:32

3K+ Views

In today's digital age, the ability to seamlessly convert between speech and text has become increasingly important. From voice-controlled assistants to transcription services, this functionality is in high demand across a wide range of applications. Python, with its extensive library ecosystem, offers powerful tools and APIs that make it relatively straightforward to implement speech-to-text and text-to-speech conversions. In this blog post, we will explore how to leverage Python to convert speech to text and text to speech, empowering developers to create innovative applications that bridge the gap between spoken and written communication. Converting Speech to Text The first step ... Read More

Sorting given Character Array using Linked List

Shubham Vora
Updated on 14-Aug-2023 13:32:25

311 Views

In this problem, we need to sort the given array of characters using a linked list. We can use bubble sort, selection sort, merger sort, etc. techniques to sort the array. Here, we will convert the array into the linked list first and then use the selection sort and bubble sort techniques to sort the array. Problem statement − We have given an array arr[] of length N. The array contains lowercase alphabetical characters. We need to sort the array using the linked list. Sample examples Input arr[] = {'e', 's', 'a', 'x', 'c', 'e', 'f', 'p', 'b', 'n', ... Read More

Python3 Program for Minimum Rotations Required to get the Same String

Shubham Vora
Updated on 14-Aug-2023 13:28:47

139 Views

In this problem, we need to find the total number of rotations to get the same string. The naïve approach to solving the problem is that we can keep rotating the string. We can print the total number of required rotations if we find the same string. Also, other approaches take the substring from the string and make it equal to the original string. After that, we can get rotations using the substring length. Problem statement − We have given string str. We need to find the total number of rotations required to get the same string again. Sample examples ... Read More

AttributeError in Python

Priya Sharma
Updated on 14-Aug-2023 12:40:53

341 Views

Python is a versatile and powerful programming language that allows developers to build a wide range of applications. However, like any programming language, Python is not immune to errors. One common error that developers encounter is the AttributeError. Let’s explore what an AttributeError is, why it occurs, and how to handle it effectively. What is an AttributeError? An AttributeError is an exception that occurs when an object does not have a particular attribute or method that is being accessed. It is raised when an invalid attribute reference or assignment is made to an object. Reasons for AttributeError An AttributeError can ... Read More

Age Calculator using Python Tkinter

Tapas Kumar Ghosh
Updated on 11-Jul-2025 17:34:00

2K+ Views

An age calculator in Python using Tkinter is a GUI (Graphical User Interface) application that allows users to determine their age based on their date of birth (DOB). To design the user interface of this application, we use various methods provided by the Tkinter library such as Tk(), pack(), Entry(), Button(), and more. GUI of Age Calculator Let us build a GUI-based age calculator where the user can enter their age in the format of years, months, and days. Ensure that single-digit numbers are prefixed with a 0. Creating an Age Calculator Application using Python Tkinter To create an ... Read More

Advertisements