Found 10401 Articles for Python

Replace two Substrings (of a String) with Each Other

Neetika Khandelwal
Updated on 22-Aug-2023 18:05:28

183 Views

You are given three strings S, A and B. You have to replace every sub−string of S equal to A with B and every sub−string of S equal to B with A. There is a possibility that two or more sub−strings matching A or B overlap. To avoid this confusion about the situation, you have to find the leftmost sub−string that matches A or B, replace it, and then continue with the rest of the string. Input S = “aab”, A = “aa”, B = “bb” Output “bbb” Match the first two characters with A and ... Read More

Minimum number of given Operations Required to Convert a String to Another String

Neetika Khandelwal
Updated on 22-Aug-2023 17:50:09

1K+ Views

You are given two strings A and B, the task is to convert from string A to string B, if possible. You are allowed to perform only one operation that is to put any character from A and insert it at front. Check if it’s possible to convert the string. If yes, then output minimum number of operations required for transformation. Input output Scenarios Assume we have two strings A and B with values "ABD" and "BAD" respectively the operation need to take to convert the first string to the latter is 1 which is swapping the first two characters. ... Read More

Find the Order of Execution of given N Processes in Round Robin Scheduling

Neetika Khandelwal
Updated on 22-Aug-2023 17:24:03

586 Views

In this article, you will learn about how to find the order of execution for the given N processes in the Round Robin Scheduling algorithm. But before starting with the code, let’s understand a bit about how this algorithm works. Round Robin Scheduling is a popular CPU scheduling algorithm used in operating systems to allocate CPU time to multiple processes in a fair and efficient manner. In this blog, we will explore how round−robin scheduling works, its advantages and disadvantages, and provide an example to help you understand the concept better. What is Round Robin Scheduling? Round Robin Scheduling is ... Read More

Fetching Zipcodes of Locations in Python using Uszipcode Module

Gaurav Leekha
Updated on 21-Aug-2023 17:46:19

2K+ Views

The Python Uszipcode module is a powerful tool for working with United States zip codes in Python. This module provides a comprehensive set of functions and classes for working with zip codes, including searching for zip codes, identifying the location associated with a zip code, and calculating the distance between two zip codes. In this article, we will provide a detailed overview of the Python Uszipcode module and how it can be used to solve a variety of problems. What is the Python Uszipcode Module? The Python Uszipcode module is a Python library for working with United States zip codes. ... Read More

Complete Guide to Python StringIO Module with Examples

Gaurav Leekha
Updated on 21-Aug-2023 17:44:26

3K+ Views

Sometimes we need data to be created or read in memory instead of actual files seen by the OS. This is where the Python StringIO module, an in-memory file-like object, comes into play. Read through this article to get a detailed explanation about the Python StringIO module. What is Python StringIO Module? Python StringIO module is an in-memory file-like object which can be used as both input and output to most of the functions expecting a standard file object. In other words, the file-like object acts like a regular file allowing most of the standard file I/O operations. One of ... Read More

Check Multiple Conditions in IF statement using Python

Gaurav Leekha
Updated on 21-Aug-2023 17:42:17

14K+ Views

When writing programs, it is often necessary to check multiple conditions in order to determine the appropriate course of action. In Python, the "if" statement is used to execute a block of code if a specific condition is true. However, in many cases, we need to check more than one condition at a time, which can be accomplished using logical operators, parentheses, and other tools. In this article, we will explore several techniques for checking multiple conditions within an "if" statement using Python. We will discuss the use of logical operators such as and, or, and not, as well as ... Read More

A Beginner’s Guide to Image Classification using CNN (Python implementation)

Gaurav Leekha
Updated on 21-Aug-2023 17:40:30

1K+ Views

Convolutional Neural Networks (CNNs) are a type of neural network that is specifically designed to process data with a grid-like topology, such as an image. CNNs are composed of a number of convolutional and pooling layers, which are designed to extract features from the input data, and a fully connected layer, which is used to classify the features. The primary advantage of CNNs is that they are able to automatically learn the features that are most relevant for the task at hand, rather than having to rely on manual feature engineering. This makes them particularly well-suited for image classification tasks, ... Read More

7 Easy Steps to Build a Machine Learning Classifier with Codes in Python

Gaurav Leekha
Updated on 21-Aug-2023 17:38:39

670 Views

Machine Learning (ML), a branch of Artificial Intelligence (AI), is more than a buzzword right now. It is continuously growing and set to be the most transformative technology existing over the next decade. A few applications of machine learning that have already started having an impact on society include self-driving vehicles, fraud detection systems, and tumor detection. Machine learning became part of our daily routines as well. From voice-enabled personal assistants (PAs) like Siri, Alexa, and Google Assistant to optimized music, movies, news, and shopping recommendations, to suggestive searches, everything we use is directly or indirectly influenced by machine ... Read More

5 Simple Ways to Perform Tokenization in Python

Shriansh Kumar
Updated on 12-Jul-2025 23:42:28

5K+ Views

Tokenization is the process of splitting a string into smaller pieces (tokens). In the context of natural language processing (NLP), tokens are words, punctuation marks, and numbers. Tokenization is a preprocessing step for many NLP tasks, as it allows you to work with individual words and symbols rather than raw text. In this article, we will look at five ways to perform tokenization in Python: Using the split() Method Using the NLTK Library Using Regular Expressions Using the shlex Module Using the ... Read More

Flipkart Product Price Tracker using Python

Atharva Shah
Updated on 21-Aug-2023 17:09:16

410 Views

Flipkart, one of India's biggest online retailers, offers a variety of products at competitive costs, yet it may be difficult to manually monitor pricing due to Flipkart's rapid price fluctuations in response to discounts and offers. This step-by-step tutorial will teach you how to build a Python Flipkart product price tracker that will allow you to locate reasonable sales pricing and follow price changes in the background. Syntax To build a Flipkart product price tracker using Python, we need to install the following modules − requests − to fetch the webpage of the product BeautifulSoup − to parse the ... Read More

Advertisements