Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles on Trending Technologies
Technical articles with clear explanations and examples
Find missing elements in List in Python
When working with a list of numbers, you may need to find which values are missing from a contiguous sequence. Python provides several approaches to identify missing elements from 0 to the maximum value in the list. Using List Comprehension with range() and max() The most straightforward approach uses list comprehension to check each number in the range and identify which ones are not in the original list ? numbers = [1, 5, 6, 7, 11, 14] # Original list print("Given list:", numbers) # Find missing elements using list comprehension missing = [num for ...
Read MoreCreate survey form in HTML and CSS
Creating a survey form in HTML and CSS allows you to build interactive forms for collecting user feedback and data. This tutorial demonstrates how to create a professional, responsive survey form with modern styling and interactive elements. Syntax /* Basic form styling */ form { display: flex; flex-direction: column; } .form-group { margin-bottom: 1rem; } input, select, textarea { padding: 0.5rem; border: 1px solid #ccc; border-radius: 4px; } Complete ...
Read MoreFind mismatch item on same index in two list in Python
Sometimes we need to compare elements in two Python lists based on both their value and position. This article shows different methods to find indices where elements at the same position have different values. Using for Loop We can design a for loop to compare values at similar indexes. If the values do not match, we add the index to a result list ? listA = [13, 'Mon', 23, 62, 'Sun'] listB = [5, 'Mon', 23, 6, 'Sun'] # Index variable idx = 0 # Result list res = [] # With iteration ...
Read MoreFind Min-Max in heterogeneous list in Python
A Python list can contain both strings and numbers, creating what we call a heterogeneous list. In this article, we will explore different methods to find the minimum and maximum numeric values from such mixed-type lists. Finding Minimum Value We can use the isinstance() function to filter only numeric values and then apply the min() function to find the smallest number. Example data = [12, 'Sun', 39, 5, 'Wed', 'Thu'] # Given list print("The Given list:", data) # Filter integers and find minimum res = min(i for i in data if isinstance(i, int)) ...
Read More9 Dot Menu using HTML and CSS
The 9 dots menu is a grid of nine clickable icons arranged in a 3x3 layout. When clicked, the menu expands to reveal individual icons that provide quick access to different functions. In this tutorial, we will learn how to create a 9 Dot Menu using HTML, CSS, and a little bit of JavaScript. Syntax .navigation { position: relative; width: 70px; height: 70px; transition: width 0.5s, height 0.5s; } .navigation.active { width: 200px; ...
Read MoreFind Maximum difference pair in Python
Data analysis often requires finding pairs of elements with specific characteristics. In this article, we will explore how to find pairs of numbers in a list that have the maximum difference between them using different Python approaches. Using nlargest() with combinations() This approach finds all possible combinations of elements, calculates their differences, and uses nlargest() from the heapq module to get multiple pairs with maximum differences. Example from itertools import combinations from heapq import nlargest numbers = [21, 14, 30, 11, 17, 18] print("Given list:", numbers) # Find top 2 pairs with ...
Read MoreFind longest consecutive letter and digit substring in Python
A given string may be a mixture of digits and letters. In this article, we will find the longest consecutive substring of letters and the longest consecutive substring of digits separately using two different approaches. Using Regular Expression Module The regular expression module can identify all continuous substrings containing only digits or only letters. We use findall() to extract these substrings and max() with key=len to find the longest ones ? Example import re def longSubstring(text): # Find all consecutive letter sequences letter = max(re.findall(r'\D+', text), ...
Read MoreCredit Card UI Design in HTML & CSS
To design a Credit Card UI in HTML & CSS, we create a responsive form that mimics the appearance and layout of a real credit card. This involves structuring HTML elements for card details and styling them with CSS to create an attractive, user-friendly interface. Steps to Create Credit Card UI Design To design a credit card UI in HTML and CSS, we will create the following structure ? HTML structure with form elements for card details CSS styling for visual design and responsive layout ...
Read MoreFind keys with duplicate values in dictionary in Python
While dealing with dictionaries, we may come across situations when there are duplicate values in the dictionary while the keys remain unique. In this article we will see how to find keys that share the same values using different approaches. Method 1: Using Key-Value Exchange We exchange the keys with values of the dictionaries and then keep appending the keys associated with a given value. This way the duplicate values get grouped together ? Example dictA = {'Sun': 5, 'Mon': 3, 'Tue': 5, 'Wed': 3} print("Given Dictionary:", dictA) k_v_exchanged = {} for ...
Read MoreFind k longest words in given list in Python
When working with lists of words, you often need to find the k longest words. Python provides several approaches to accomplish this task efficiently using built-in functions like sorted(), enumerate(), and heapq. Using sorted() with Length as Key The simplest approach is to sort words by length in descending order and slice the first k elements ? def k_longest_words(words, k): return sorted(words, key=len, reverse=True)[:k] words = ['Earth', 'Moonshine', 'Aurora', 'Snowflakes', 'Sunshine'] k = 3 result = k_longest_words(words, k) print(f"Top {k} longest words: {result}") Top 3 longest words: ['Snowflakes', ...
Read More