Found 34494 Articles for Programming

Validating UPI IDs using Regular Expressions

Shubham Vora
Updated on 27-Oct-2023 16:13:48

1K+ Views

In this problem, we will validate the UPI id using the regular expression. The UPI is the unified payment interface that is given to each customer, and other people can use it to transfer money to you. The UPI id contains alphanumeric characters. The UPI id should always contain a ‘@’ character. The UPI id should not have white spaces. The UPI id may have a dot(.) or hyphen(-). Problem statement − We have given an upi id in the string format. We need to validate the UPI id using the regular expression. Sample Examples Input: upi ... Read More

Minimum deletion such that XOR of adjacent digits is atmost 1

Shubham Vora
Updated on 27-Oct-2023 14:56:08

72 Views

In this problem, we will learn to find the count of minimum deletion required so that when we take the XOR of any two adjacent elements, we should either get 0 or 1. We will use the properties of the XOR operations to solve the problem. For example, when we take XOR of the same numbers, we always get 0; when we take XOR of the consecutive even and odd number, we get 1. Problem Statement We have given a num_str string containing the numeric digits. We need to count the minimum deletions required so that the XOR ... Read More

Maximum moves to reach destination character in a cyclic String

Shubham Vora
Updated on 23-Oct-2023 15:59:58

68 Views

In this problem, we will find the maximum distance from the initial to the final character in the cyclic string. The basic approach to solve the problem is to find the next closest final character for every initial character and update the maximum distance if required. Another approach traverses the string in reverse order and keeps track the index of the last final character. When we get an initial character, we measure the distance and update the maximum distance if required. Problem statement − We have given an str string containing the 3 characters, and the length equals N. Also, ... Read More

Maximize value of Binary String in K steps by performing XOR of Substrings

Shubham Vora
Updated on 23-Oct-2023 15:11:47

174 Views

In this problem, we will maximize the value of the binary string by performing K XOR operations of substrings of the given binary string. To maximize any binary string, we should maximize the substring starting from the leftmost zero. For example, to maximize the ‘11001’ string, we need to choose another substring in such a way that we can maximize the ‘001’ substring. Problem Statement We have given a binary string named bin_str containing N characters. We have to maximize the value of the binary string in K operations by taking the XOR operation of any two substrings. It ... Read More

JavaScript Alternatives

Shirjeel Yunus
Updated on 30-Aug-2023 11:30:26

92 Views

What is JavaScript? JavaScript is a programming and Scripting language which users can use to add functionalities to different webpages. Developers can make interactive webpages add maps, images, and do a lot of other things. JavaScript came to be known as LiveScript when launched later Netscape changed its name to JavaScript. JavaScript is usually to develop the frontend but backend programming can also be done. Price Plans of JavaScript JavaScript is free to use and developers can develop interactive webpages using the language Why JavaScript alternatives? There are many disadvantages of JavaScript and some of them can be found here ... Read More

How To Add Color Breezing Effect Using Pygame?

Shashank Dharasurkar
Updated on 29-Aug-2023 17:00:13

116 Views

A popular Python game development library, Pygame provides a broad range of functions for creating 2D games. Using SDL, a low−level multimedia library, it handles graphics, sound, and input in games. The Pygame library allows you to create Python based games easily and intuitively. Creating a breathing effect A breathing effect is a visual effect where the color of an object pulsates or fades in and out, giving the illusion that it is breathing." By combining RGB values and blending modes, Pygame can create a breathing effect that adds depth and visual interest to game objects. Pygame's color manipulation involves ... Read More

How To Add Color Bar In Bokeh

Shashank Dharasurkar
Updated on 29-Aug-2023 16:58:22

192 Views

In Python, Bokeh is one of the most powerful libraries for data visualization that goes beyond traditional plotting. It follows a unique "Grammar of Graphics" architecture that allows developers to build interactive visualizations by managing graphical elements together. A Bokeh plot brings your data to life with its seamless integration with Pandas, NumPy, and SciPy. What is a Color Bar? Color bar is a visualization tool where color is used to represent a continuous variable like a heatmap. The main objective of the color bar is to allow users to understand the ... Read More

How to Add A Color Picker In Bokeh?

Shashank Dharasurkar
Updated on 27-Nov-2023 11:57:50

126 Views

Bokeh is one of the most underrated Python visualization libraries and can be used for various applications, including data analysis, scientific visualization, interactive dashboards, etc. In this blog, we will learn how to add a colorpicker widget in Bokeh. What’s A Color Picker? Color picker is one of the many widgets present in Bokeh. It helps the user to specify an RGB color value. Widgets add interactions to the graphs, which can then help users to update plots or drive new computations without diving into code. Besides the color picker, Bokeh has many interesting widgets like buttons, checkbox groups, ... Read More

Union of Python Tuples

Pranay Arora
Updated on 29-Aug-2023 13:41:48

385 Views

A tuple, in python, is a sequential data structure that consists of a number of values. It is an immutable data structure. Hence, it is tricky to get a union of two tuples. Through this article we will try to dive into a few of the best possible approaches and understand their implementation in Python. Tuples, in python, are immutable, but they can contain mutable objects. Similarly, we can take help of mutable data structures to get our desired union. The union of Python tuples finds applications in removing duplicates, merging data sources, set operations, data deduplication, merging multiple results, ... Read More

Python - Type conversion in Nested and Mixed List

Pranay Arora
Updated on 29-Aug-2023 13:14:18

202 Views

Python is widely used and accepted today because of its versatility and readability. Its powerful features allow developers to perform complex tasks with ease. One such essential feature is type conversion or type casting. Especially with Python lists, which are heterogeneous in nature which often demands converting each nested list element or lists to be converted to a particular data type for use. In mixed lists, it becomes more complex. In this article, we will try to understand and implement type conversion in Nested and Mixed Lists. Through the codes we will decode the python features to implement the ... Read More

Advertisements