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
Custom list split in Python
Data analytics throws complex scenarios where the data need to be wrangled and moved around. In this context let's see how we can take a big list and split it into many sublists as per the requirement. In this article we will explore the approaches to achieve this. Using List Comprehension and zip() In this approach we use list slicing to get the elements from specific split points. Then we use zip() to create start and end indices for each sublist. Example data_list = ['Mon', 'Tue', 'Wed', 6, 7, 'Thu', 'Fri', 11, 21, 4] ...
Read MoreCreate list of numbers with given range in Python
Python provides several built-in functions and libraries to generate sequences of numbers within a specified range. This article explores different approaches using range(), random.randrange(), and NumPy's arange() function. Using range() Function The range() function generates a sequence of numbers starting from 0 by default, incrementing by 1, and ending before a specified number. You can customize the start, end, and step values to meet your requirements. Example def generate_numbers(start, end, step): return list(range(start, end, step)) # Generate numbers from -3 to 6 with step 2 start, end, step = -3, ...
Read MoreHow to hide the bullets on list for the sidebar?
When designing a sidebar for a website, bullet points can detract from the clean, professional appearance you want to achieve. Fortunately, CSS provides several effective methods to hide these bullets while maintaining the semantic structure of your lists. Syntax selector { list-style-type: none; } Method 1: Using list-style-type Property The most straightforward approach is to use the list-style-type property and set it to none. This removes bullet points from list items ? .sidebar-list { ...
Read MoreConvert 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 More