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
Dictionary creation using list contents in Python
Changing the collection type from one type to another is a very frequent need in Python. In this article we will see how we create a dictionary when multiple lists are given. The challenge is to combine all these lists to create one dictionary accommodating all these values in a dictionary key-value format. Using zip() Function The zip() function can be used to combine the values of different lists. In the below example we have taken three lists as input and combine them to form a single dictionary. One of the lists supplies the keys for the dictionary ...
Read MoreDelete items from dictionary while iterating in Python
A Python dictionary is a collection which is unordered, changeable and indexed. They have keys and values and each item is referenced using the key. Modifying a dictionary while iterating over it can cause runtime errors, so we need special techniques to safely delete items during iteration. Using del with Collected Keys In this approach we first collect the keys that need to be deleted, then iterate through this separate list to delete the items. This prevents modification of the dictionary during iteration ? Example # Given dictionary days_dict = {1: 'Mon', 2: 'Tue', 3: ...
Read MoreHow do HTML and CSS work together?
HTML (HyperText Markup Language) is a markup language that creates the structure and skeleton of a website, while CSS (Cascading Style Sheets) is a styling language that makes the skeleton attractive by applying visual properties. Think of HTML as the foundation and framework of a house, and CSS as the paint, decorations, and interior design that make it beautiful. How HTML and CSS Work Together When a user requests a webpage, the server sends HTML and CSS files to the browser. The browser first reads the HTML to understand the page structure, then applies CSS styles to make ...
Read MoreDelete elements with frequency atmost K in Python
While manipulating data from lists we may come across scenarios where we need to selectively remove elements from the list based on their frequency. In this article we will explore how to remove all elements from a list whose frequency is at most K (less than or equal to K). We'll demonstrate with K=2, but you can change this value to any number in the programs. Using count() Method The count() method returns the frequency of each element in the list. We use it with list comprehension and put a condition to only keep elements whose count is ...
Read MoreHow to create a Gradient Shadow using CSS ?
The CSS gradient shadow effect creates stunning visual shadows using color gradients instead of traditional solid shadows. This technique combines the ::after pseudo-element with CSS gradient functions and filter properties to create eye-catching shadows that enhance UI design. Syntax .element::after { content: ""; position: absolute; inset: -0.5rem; background: linear-gradient(direction, color1, color2, ...); /* or */ background: radial-gradient(color1, color2, ...); filter: blur(value); z-index: -1; } ...
Read MoreDelete elements in range in Python
Deleting elements from a Python list by specific indices requires careful handling to avoid index shifting issues. This article explores two effective approaches to delete multiple elements based on their index positions. Using sorted() with del Statement The most straightforward approach is to sort the indices in reverse order and delete elements from highest to lowest index. This prevents index shifting issues ? Example numbers = [11, 6, 8, 3, 2] # The indices to delete indices_to_delete = [1, 3, 0] # printing the original list print("Given list is :", numbers) print("The indices ...
Read MoreHow to Create Dark Theme using Slider in CSS?
Dark themes have grown in popularity recently since they can lessen eye fatigue and make it easier to watch display screens for extended periods of time. This article will discuss how to use CSS and JavaScript to create an interactive slider that toggles between light and dark themes. A CSS slider, commonly referred to as a range slider, is a user interface component that enables users to choose a value within a range by sliding a handle along a track. They are frequently employed in settings panels and web forms for theme switching. Syntax input[type="range"] { ...
Read MoreCustom 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 More