Python - Check if all elements in a list are identical

Pradeep Elance
Updated on 15-Mar-2026 18:15:18

1K+ Views

There may be occasions when a list contains all identical values. In this article we will see various ways to verify that all elements in a list are the same. Using all() Function We use the all() function to compare each element of the list with the first element. If each comparison returns True, then all elements are identical ? days_a = ['Sun', 'Sun', 'Mon'] result_a = all(x == days_a[0] for x in days_a) if result_a: print("In days_a all elements are same") else: print("In days_a all ... Read More

Python - Check if a list is contained in another list

Pradeep Elance
Updated on 15-Mar-2026 18:15:02

1K+ Views

Given two different Python lists, we need to find if the first list is a part of the second list as a contiguous subsequence. Python provides several approaches to check if one list is contained within another. Using map() and join() We can convert both lists to comma-separated strings using map() and join(), then use the in operator to check containment ? fruits = ['apple', 'banana', 'cherry'] inventory = ['cherry', 'grape', 'apple', 'banana', 'cherry', 'kiwi'] print("Given fruits elements:") print(', '.join(map(str, fruits))) print("Given inventory elements:") print(', '.join(map(str, inventory))) # Convert to strings and check containment ... Read More

Creating a Quiz Tool: A Complete Beginner's Guide

Naveen Kumawat
Updated on 15-Mar-2026 18:14:59

3K+ Views

Creating a quiz tool is a great way to learn web development fundamentals. This guide will walk you through building an interactive quiz application using HTML for structure, CSS for styling, and JavaScript for functionality. Project Overview Our quiz tool will include the following features − Question Display: Show one question at a time with multiple choice options User Interaction: Allow users to select answers using radio buttons Score Tracking: Keep track of correct answers and display final score Navigation: ... Read More

Python - Check if a given string is binary string or not

Pradeep Elance
Updated on 15-Mar-2026 18:14:42

7K+ Views

In this article we check if a given string contains only binary digits (0 and 1). We call such strings binary strings. If the string contains any other characters like 2, 3, or letters, we classify it as a non-binary string. Using set() Method The set() function creates a collection of unique characters from a string. We can compare this set with the valid binary characters {'0', '1'} to determine if the string is binary ? def is_binary_string_set(s): binary_chars = {'0', '1'} string_chars = set(s) ... Read More

Password validation in Python

Pradeep Elance
Updated on 15-Mar-2026 18:14:23

3K+ Views

Password validation is essential for securing applications. In this article, we will see how to validate if a given password meets certain complexity requirements using Python's re (regular expression) module. Password Requirements Our validation will check for the following criteria ? At least one lowercase letter (a-z) At least one uppercase letter (A-Z) At least one digit (0-9) At least one special character (@$!%*#?&) Password length between 8 and 18 characters Regular Expression Breakdown The regex pattern ^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*#?&])[A-Za-z\d@$!#%*?&]{8, 18}$ uses positive lookaheads to ensure all conditions are met ? ^ - ... Read More

Build a Technical Documentation Website Using HTML and CSS

Souvik Chakraborty
Updated on 15-Mar-2026 18:14:18

503 Views

Learn how to design a technical documentation website using HTML and CSS. This layout is optimized for programming documentation with user-friendly navigation and clean content organization. HTML provides the semantic structure while CSS handles styling and responsive design, creating a professional documentation experience similar to popular programming references. Navigation What is C++ Objects & Classes Inheritance Polymorphism Main Documentation Content Documentation sections with detailed explanations Code examples with syntax highlighting Structured content with proper typography #include using namespace std; int main() { cout

Multi-dimensional lists in Python

Pradeep Elance
Updated on 15-Mar-2026 18:14:01

10K+ Views

Lists are a very widely used data structure in Python. They contain a list of elements separated by commas. But sometimes lists can also contain lists within them. These are called nested lists or multidimensional lists. In this article we will see how to create and access elements in a multidimensional list. Creating Multi-dimensional Lists In the below program we create a multidimensional list of 4 columns and 3 rows using nested for loops ? multlist = [[0 for columns in range(4)] for rows in range(3)] print(multlist) The output of the above code is ... Read More

Launching parallel tasks in Python

Pradeep Elance
Updated on 15-Mar-2026 18:13:39

472 Views

Parallel processing allows Python programs to break work into independent subprograms that can run simultaneously. This improves performance by utilizing multiple CPU cores and reducing overall execution time. Using multiprocessing Module The multiprocessing module creates child processes that run independently from the main process. Each process has its own memory space and can execute code in parallel ? Basic Process Creation import multiprocessing import time class WorkerProcess(multiprocessing.Process): def __init__(self, process_id): super(WorkerProcess, self).__init__() self.process_id = ... Read More

How to Resize SVG in HTML?

Tanya Sehgal
Updated on 15-Mar-2026 18:13:27

477 Views

Every HTML document can contain different image formats, such as PNG, JPEG, SVG, GIF, etc. that can be adjusted according to your needs. This article will explore various ways to resize an SVG image in HTML. What is SVG? SVG (Scalable Vector Graphics) is an XML-based image format used in web development. It can be scaled to any size without losing quality, making it ideal for logos and icons. These images are resolution-independent, meaning they maintain crisp edges at any size. Syntax /* CSS approach */ svg { width: value; ... Read More

Importing Data in Python

Pradeep Elance
Updated on 15-Mar-2026 18:13:20

17K+ Views

When working with data analysis in Python, importing data from external sources is a fundamental skill. Python provides several powerful modules for reading different file formats including CSV, Excel, and databases. Let's explore the most common approaches for importing data. Importing CSV Files The built-in csv module allows us to read CSV files row by row using a specified delimiter. We open the file in read mode and iterate through each row ? import csv import io # Sample CSV data csv_data = """customerID, gender, Contract, PaperlessBilling, Churn 7590-VHVEG, Female, Month-to-month, Yes, No 5575-GNVDE, Male, ... Read More

Advertisements