Found 34494 Articles for Programming

Maximize sum by picking Array element to left of each ‘1’ of a Binary String

Shubham Vora
Updated on 23-Oct-2023 15:03:43

67 Views

In this problem, we will find the maximum sum of array elements by picking up unselected elements at the left from the current 1's index. We can use the vector list and sort() method to solve the problem or priority queue. The priority queue inserts the element in the sorted order. Problem Statement We have given a binary string alpha and arr[] of the same length. We need to pick all '1' of alpha one by one and take the maximum element which is not picked from the subarray of arr[] formed using 0 to p elements. Here, ... Read More

Make all Strings palindrome by swapping characters from adjacent Strings

Shubham Vora
Updated on 23-Oct-2023 14:54:49

387 Views

In this problem, we will make all strings of the given array palindromic by swapping the characters of the adjacent string. To solve the problem, we will try to make the character the same at p and str_len - p - 1 index in all strings, and it is only possible if overall characters at pth index and (str_len - p - 1) index is same. Problem statement - We have given an arr containing multiple strings of the same length equal to N. We need to count the minimum number of operations required to make all strings of ... Read More

Find Strings formed by replacing prefixes of given String with given characters

Shubham Vora
Updated on 20-Oct-2023 14:45:29

75 Views

In this problem, we will form a triangle from the given string. The triangle will contain the rows equal to the string length - 1, and in each row, we replace the starting characters equal to the row number with '.' Character. We can use the loop to form each row of the string or string constructor and substr() method. Problem statement - We have given a string alpha. We need to print the string in the triangle pattern. We need to start the triangle with the alpha string and replace the first character of the previous string ... Read More

Writing a crontab file in Python using the Plan Module

S Vijay Balaji
Updated on 31-Aug-2023 12:44:18

60 Views

First, let us understand what a crontab file is. Cron is a software utility that helps us schedule tasks on the Unix based systems. So basically, you’ll be able to periodically run assigned tasks, for example, automated system backups at the end of the day, to auto shutdown or set mode to DND at a particular time and more such features. These "tasks" in cron are usually defined in a file called crontab, which is basically a text file that contains the commands to be executed. Let us now learn how we can write these crontab files in Python using ... Read More

Developing a Web Crawler with Python and the Requests Library

S Vijay Balaji
Updated on 31-Aug-2023 12:41:24

155 Views

From news articles and e−commerce platforms to social media updates and blog posts, the web is a treasure trove of valuable data. However, manually navigating through countless web pages to gather this information is a time−consuming and tedious task. That's where web crawling comes in. What is Web Crawling? Web crawling, also known as web scraping, is a technique used to systematically browse and extract data from websites. It involves writing a script or program that automatically visits web pages, follows links, and gathers relevant data for further analysis. This process is essential for various applications, such as web indexing, ... Read More

Developing a Text Search Engine using the Whoosh Library in Python

S Vijay Balaji
Updated on 31-Aug-2023 12:39:26

788 Views

Whoosh is a python library of classes and functions for indexing text and then searching the index. Suppose you are building an application that needs to go through various documents and then find similarities or get data from it based on a few predefined conditions, or let's say you want to count the number of times the title of the project is mentioned in a research paper, then what we are building in this tutorial will come in handy. Getting Started For building our text search engine, we will be working with the whoosh library. This library does not come ... Read More

Developing a Machine Learning Model with Python and scikit-learn

S Vijay Balaji
Updated on 31-Aug-2023 12:36:15

105 Views

Machine learning is a branch of artificial intelligence that allows machines to learn and improve on their own without explicit programming. Scikit−learn is a popular Python library for machine learning that provides various tools for predictive modeling, data mining, and data analysis. In this tutorial, we will explore how to develop a machine learning model using the scikit−learn library. We will start with a brief introduction to machine learning and the scikit−learn library. We will then move on to the main content, which includes data preprocessing, model selection, model training, and model evaluation. We will use a sample dataset ... Read More

Creating a Web-based Data Visualization Dashboard with Python and Plotly Dash

S Vijay Balaji
Updated on 31-Aug-2023 12:33:12

363 Views

Data visualization allows us to explore patterns, trends, and relationships within our data, enabling us to derive meaningful insights. In this tutorial, we will explore how to create a web−based data visualization dashboard using Python and Plotly Dash. What is Plotly Dash? Python, being a popular programming language for data analysis and visualization, offers various libraries and frameworks to create interactive visualizations. One such powerful framework is Plotly Dash. Plotly Dash is a Python framework that allows you to build interactive web applications and dashboards with ease. It combines the simplicity and versatility of Python with the flexibility and ... Read More

Control Raspberry Pi GPIO Pins Using Python

S Vijay Balaji
Updated on 31-Aug-2023 12:31:51

424 Views

Raspberry Pi is a popular single−board computer that is widely used for various projects, ranging from home automation to robotics. One of the key features of Raspberry Pi is its ability to interface with the physical world through its GPIO (General Purpose Input/Output) pins. These pins allow you to connect sensors, actuators, and other electronic components to the Raspberry Pi and control them with software. Python is a versatile programming language that is widely used for developing applications on Raspberry Pi. In fact, the Raspberry Pi OS comes with Python pre−installed, making it a natural choice for programming GPIO pins. ... Read More

Building a Stock Price Prediction Model with Python and the Pandas Library

S Vijay Balaji
Updated on 31-Aug-2023 12:30:16

365 Views

Stock price prediction is a frequent use case in machine learning and data analysis. We can construct models that forecast future stock prices with fair accuracy by analysing past trends and patterns in the stock market. In this lesson, we'll look at how to use Python and the pandas package to create a stock price prediction model. The pandas library is a popular Python data analysis package. It includes a comprehensive collection of tools for working with structured data, such as data frames and series. We'll use pandas to analyse and manipulate stock data before developing a machine learning model ... Read More

Advertisements