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
Convert list of string to list of list in Python
In this article we will see how to convert a list of strings that represent lists into actual nested lists. This is useful when you have string representations of lists and need to convert them back to proper list structures. Using strip() and split() The strip() method removes the square brackets, while split() separates the elements by comma and space ? Example string_list = ['[0, 1, 2, 3]', '["Mon", "Tue", "Wed", "Thu"]'] print("The given list is:") print(string_list) print() # using strip() + split() result = [item.strip("[]").split(", ") for item in string_list] print("Converting list of ...
Read MoreHow to hide number input spin box using CSS?
To hide number input spin box using CSS, we will be discussing two different approaches in this article. The number input spin box is a commonly used component in web forms allowing users to increase or decrease numeric values with up and down arrows. In this article, we are having a number type input spin box, our task is to hide number input spin box using CSS. Syntax /* Method 1: Using display property */ ::-webkit-inner-spin-button { display: none; } /* Method 2: Using appearance property */ ::-webkit-inner-spin-button { ...
Read MorePython - Clearing list as dictionary value
In Python, you may have a dictionary where values are lists and need to clear all the list values while keeping the keys. There are two main approaches: using the clear() method to empty existing lists in-place, or using dictionary comprehension to assign new empty lists. Using Loop with clear() Method The clear() method empties existing lists in-place, preserving the original list objects ? fruits = {"Apple": [4, 6, 9, 2], "Grape": [7, 8, 2, 1], "Orange": [3, 6, 2, 4]} print("Original dictionary:", fruits) # Clear each list in-place for key in fruits: ...
Read MoreHow to give a div tag 100_ height of the browser window using CSS?
When working on web development projects, there are often scenarios where you need to give a div tag the full height of the browser window. This can be particularly useful when creating full-page layouts, hero sections, or elements that need to span the entire vertical space. However, achieving this desired effect using CSS can be a bit tricky due to the nature of the CSS Box Model and the default behavior of height properties. Syntax /* Method 1: Using percentage height */ selector { height: 100%; } /* Method 2: Using ...
Read MorePython - Check if frequencies of all characters of a string are different
In this article, we will see how to find the frequency of each character in a given string and check if all characters have different frequencies. We'll accomplish this in two steps: first calculating character frequencies, then checking if all frequencies are unique. Finding Character Frequencies We can count character frequencies using a dictionary. For each character in the string, we either increment its count or initialize it to 1 ? Example in_string = "She sells sea shells" char_freq = {} for char in in_string: if char in char_freq.keys(): ...
Read MorePython - Check if dictionary is empty
During analysis of data sets we may come across situations where we have to deal with empty dictionaries. In this article we will see how to check if a dictionary is empty or not. Using if Statement The if condition evaluates to True if the dictionary has elements. Otherwise it evaluates to False. This is the most Pythonic way to check dictionary emptiness ? Example dict1 = {1: "Mon", 2: "Tue", 3: "Wed"} dict2 = {} # Given dictionaries print("The original dictionary : ", (dict1)) print("The original dictionary : ", (dict2)) # Check ...
Read MoreDisplaying XML Using CSS
XML is a markup language which stands for Extensible Markup Language, designed especially for web documents. It defines a set of rules for encoding documents in a format that is both human-readable and machine-readable, allowing developers to create custom tags. In this article, we are displaying XML content using CSS to style and format XML elements for better presentation in web browsers. Syntax To link CSS to an XML file, use the following declaration at the top of your XML document − Steps for Displaying XML using CSS Follow these steps ...
Read MorePossible Words using given characters in Python
In this article, we'll see how to find possible words that can be formed using a given set of characters. We'll take a list of reference words and a list of available characters, then determine which words can be made from those characters. The program uses two functions: one to count character frequencies, and another to check if each word can be formed from the available characters. Example Here's how to find words that can be formed from given characters: def count_characters(character): char_count = {} for n ...
Read MoreDoes overflow: hidden create a new block formatting context in CSS?
The block formatting context (BFC) is a part of the web page layout in CSS where elements are positioned and interact with each other. In simple words, it is like a container that defines a set of rules for how elements should behave inside the container. In this article, we are going to see "Does overflow: hidden create a new block formatting context (BFC) in CSS?" The answer is yes because in CSS, the overflow: hidden property can create a new block formatting context (BFC). When an HTML element has an overflow value other than visible (the default ...
Read MoreAccessing all elements at given Python list of indexes
Sometimes we need to access multiple elements from a list at specific index positions. Python provides several efficient approaches to extract elements at given indices from a list. Using List Comprehension The most Pythonic approach uses list comprehension to iterate through the index list and extract corresponding elements ? days = ["Mon", "Tue", "Wed", "Thu", "Fri"] indices = [1, 3, 4] # printing the lists print("Given list: " + str(days)) print("List of indices: " + str(indices)) # use list comprehension result = [days[i] for i in indices] # Get the result print("Result list: ...
Read More