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
Finding frequency in list of tuples in Python
When working with lists containing tuples, you may need to find how frequently a specific element appears across all tuples. Python provides several efficient methods to count occurrences of elements within tuple structures. Using count() and map() The map() function extracts elements from each tuple, then count() finds the frequency of a specific element ? # initializing list of tuples fruits_days = [('Apple', 'Mon'), ('Banana', 'Tue'), ('Apple', 'Wed'), ('Orange', 'Thu'), ('Apple', 'Fri')] # Given list print("Given list of tuples:", fruits_days) # Frequency in list of tuples freq_result = list(map(lambda i: i[0], fruits_days)).count('Apple') # ...
Read MoreCreate Horizontal Scrollable Sections in CSS
A horizontal scrollable section is a popular web design pattern used to showcase content that extends beyond the width of the viewport. This design pattern allows users to scroll horizontally, providing a unique and engaging way to display large images, galleries, timelines, maps, and other content. Syntax .container { overflow-x: auto; white-space: nowrap; } .section { display: inline-block; width: 100vw; vertical-align: top; } Key Properties PropertyValuePurpose overflow-xauto or scrollEnables horizontal scrolling white-spacenowrapPrevents ...
Read MoreFind sum of frequency of given elements in the list in Python
When working with lists containing repeated elements, we often need to find the sum of frequencies for specific items. Python provides several approaches to calculate this efficiently ? Using sum() with count() This method uses the built-in count() method to find frequency of each element and sum() to calculate the total ? chk_list = ['Mon', 'Tue'] big_list = ['Mon', 'Tue', 'Wed', 'Mon', 'Mon', 'Tue'] # Apply sum res = sum(big_list.count(elem) for elem in chk_list) # Printing output print("Given list to be analysed:") print(big_list) print("Given list with values to be analysed:") print(chk_list) print("Sum of the ...
Read MoreCreate Horizontal Scroll Snap Using HTML and CSS
To create a horizontal scroll snap, we use the CSS scroll-snap-type property to produce the snap effect. The properties scroll-snap-type and scroll-snap-align specify the type of snap behavior and the alignment of the snap points, respectively. Syntax /* Container */ .container { scroll-snap-type: x mandatory; overflow-x: scroll; } /* Items */ .item { scroll-snap-align: start | center | end; } Key Properties PropertyValueDescription scroll-snap-typex mandatoryEnables mandatory horizontal scrolling snap scroll-snap-alignstartAligns snap points to the start of each section overflow-xscrollEnables horizontal ...
Read MoreFind frequency of given character at every position in list of lists in Python
Let's consider a scenario where you have a list which is made of lists as its elements. We are interested in finding the frequency of one character at different positions of the inner lists. Below example will clarify the requirement. Consider a list of lists given below: listA = [['a', 'a', 'b'], ['a', 'c', 'b'], ['c', 'a', 'b'], ['c', 'a', 'a']] print("Original list of lists:") print(listA) Original ...
Read MoreHow do I write CSS within HTML?
CSS (Cascading Style Sheets) can be written directly within HTML documents to style and format web pages. There are three primary methods to include CSS within HTML: inline CSS, internal CSS, and a combination of both methods. Syntax /* Inline CSS */ /* Internal CSS */ selector { property: value; } Method 1: Inline CSS Inline CSS uses the style attribute directly within HTML elements. This method has the highest specificity and will override other CSS styles. Example ...
Read MoreExtract only characters from given string in Python
Sometimes strings contain a mix of letters, numbers, and special characters. When you need to extract only the alphabetic characters from such strings, Python provides several efficient methods. Using isalpha() Method The isalpha() method checks if a character is alphabetic. You can combine it with a loop and join() to extract only letters ? Example text = "Qwer34^&t%y" # Given string print("Given string:", text) # Extract characters using isalpha() result = "" for char in text: if char.isalpha(): result = "".join([result, ...
Read MoreHow do I develop a webpage using HTML and CSS?
Web pages on the internet are built with HTML and styled with CSS. HTML provides the structure and content skeleton, while CSS handles the visual presentation. Learning to develop web pages requires understanding both technologies and how they work together. Syntax /* CSS Syntax */ selector { property: value; } Content HTML Fundamentals HTML (HyperText Markup Language) is the foundation of web development. It uses a hierarchical structure with tags to mark up content: Tags − Enclosed in angle brackets (< >), tags define ...
Read MoreExtract numbers from list of strings in Python
While using Python for data manipulation, we may come across lists whose elements are a mix of letters and numbers with a fixed pattern. In this article we will see how to separate the numbers from letters which can be used for future calculations. Using split() Method The split() function splits a string by help of a character that is treated as a separator. In the program below the list elements have hyphen as their separator between letters and numbers. We will use that along with list comprehension to extract each number ? days_with_numbers = ['Mon-2', ...
Read MoreHow can I get the HTML/CSS/JavaScript source code of a website?
Accessing the HTML, CSS, and JavaScript source code of a website is an essential skill for web developers and designers. Modern web browsers provide built-in developer tools that allow you to inspect and analyze any website's code structure, styling, and functionality. This tutorial will guide you through the process of viewing website source code using browser developer tools. Method 1: Using Browser Developer Tools Browser developer tools are the most comprehensive way to examine website source code. These tools provide real-time access to all three core web technologies. Step 1: Open Your Web Browser and Navigate to ...
Read More