Find all the patterns of "1(0+)1" in a given string using Python Regex

Pradeep Elance
Updated on 15-Mar-2026 17:10:51

342 Views

In this tutorial, we will find all occurrences of the pattern "1(0+)1" in a string using Python's regex module. The re module provides powerful pattern matching capabilities for text processing. The pattern "1(0+)1" represents a literal string containing the number 1, followed by parentheses with "0+" inside, and ending with another 1. Example Input and Output Input: string = "Sample 1(0+)1 string with 1(0+)1 unnecessary patterns 1(0+)1" Output: Total number of pattern matches are 3 ['1(0+)1', '1(0+)1', '1(0+)1'] Algorithm Follow these steps to find the pattern: 1. Import the re ... Read More

How to align flexbox columns left and right using CSS?

Riya Kumari
Updated on 15-Mar-2026 17:10:47

22K+ Views

To align flexbox columns left and right using CSS, we can use various flexbox properties. In this article, we will learn three different approaches to align flexbox columns left and right using CSS. Syntax /* Method 1: Using justify-content */ .container { display: flex; justify-content: flex-start | flex-end | space-between; } /* Method 2: Using margin */ .item { margin-left: auto; /* Push to right */ margin-right: auto; /* Push to left */ } Method 1: Using justify-content ... Read More

FuzzyWuzzy Python library

Pradeep Elance
Updated on 15-Mar-2026 17:10:33

912 Views

In this tutorial, we are going to learn about the FuzzyWuzzy Python library. FuzzyWuzzy library is developed to compare strings and provides fuzzy string matching capabilities. While we have other modules like regex and difflib to compare strings, FuzzyWuzzy is unique in its approach. The methods from this library return a score out of 100 indicating how closely the strings match, instead of simple true/false or string results. Installation To work with the FuzzyWuzzy library, we need to install fuzzywuzzy and optionally python-Levenshtein for better performance − pip install fuzzywuzzy pip install python-Levenshtein The ... Read More

What is the use of star-preceded property in CSS?

Riya Kumari
Updated on 15-Mar-2026 17:10:21

518 Views

In web development, CSS (Cascading Style Sheets) enables developers to control the visual appearance and layout of websites. However, different web browsers have varying levels of CSS support, which can result in inconsistent rendering across different platforms. To overcome compatibility issues, developers historically used CSS hacks to ensure consistent display across browsers. The star-preceded property (or star property hack) was one such technique used to target specific versions of Internet Explorer that had limited CSS support. Syntax selector { property: value; /* Standard property for ... Read More

Print anagrams together in Python using List and Dictionary

Pradeep Elance
Updated on 15-Mar-2026 17:10:08

798 Views

In this tutorial, we will write a program to find and print anagrams together using list and dictionary. Anagrams are words formed by rearranging the letters of another word, like "listen" and "silent". Algorithm Here's our step-by-step approach ? 1. Initialize a list of strings. 2. Initialize an empty dictionary. 3. Iterate through the list of strings. 3.1. Sort the string and check if it is present in the dictionary as key or not. 3.1.1. If the sorted string is already present dictionary as a ... Read More

How to specify that an input element should be disabled?

Tarun Singh
Updated on 15-Mar-2026 17:10:01

5K+ Views

When building forms on webpages, you sometimes need to disable input fields to prevent user interaction. This is useful for preventing users from accessing certain fields until previous steps are completed, or to avoid invalid data submission. CSS provides the :disabled pseudo-class and attribute selector to style disabled input elements, making it clear to users that these fields are not interactive. Syntax input:disabled { /* styles for disabled inputs */ } input[disabled] { /* alternative selector */ } Method 1: Using HTML disabled Attribute with ... Read More

Print first m multiples of n without using any loop in Python

Pradeep Elance
Updated on 15-Mar-2026 17:09:47

842 Views

In this tutorial, we will write a program to find the first m multiples of a number n without using loops. For example, if n = 4 and m = 3, the output should be 4, 8, 12 (three multiples of four). The main constraint is avoiding loops. We can use the range() function to achieve this without loops. The range() function returns a range object that generates a sequence of numbers. Syntax range(start, stop, step) Parameters start − Starting number of the range stop − Ending number (not included in the ... Read More

How to select “last child” with a specific class using CSS?

Tarun Singh
Updated on 15-Mar-2026 17:09:34

8K+ Views

To select the last child with a specific class using CSS is a simple process using CSS pseudo-class selectors. In this article, we will explore three different approaches to target the last element with a specific class. Syntax /* Using :last-child */ .class-name:last-child { property: value; } /* Using :nth-last-child() */ .class-name:nth-last-child(1) { property: value; } /* Using :last-of-type */ .class-name:last-of-type { property: value; } Method 1: Using :last-child Selector The CSS :last-child pseudo-class selector targets the last element inside ... Read More

Python program to count occurrences of a word in a string

Pradeep Elance
Updated on 15-Mar-2026 17:09:21

4K+ Views

In this tutorial, we will write a program that counts the number of times a word occurs in a string. You are given a word and a string, and we need to calculate the frequency of the word in the string. Suppose we have a string "I am a programmer. I am a student." and the word "am". The program will return 2 as the word occurs two times in the string. Algorithm 1. Initialize the string and the word as two variables. 2. Split the string at spaces using the split() method to get a ... Read More

How to secure cascading style sheets?

Tarun Singh
Updated on 15-Mar-2026 17:09:13

900 Views

Web development heavily relies on Cascading Style Sheets (CSS) for styling and layout. However, CSS can be vulnerable to security threats that attackers exploit to inject malicious code, steal sensitive information, or perform other harmful activities. This article covers essential techniques to secure your CSS and protect your web applications from potential attacks. Syntax Secure CSS implementation involves multiple layers of protection − /* Secure CSS practices */ selector { property: secure-value; } /* Avoid external URLs in CSS */ /* Validate all user-generated content */ /* Use Content Security Policy ... Read More

Advertisements