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
frozenset() in Python
This function helps in converting a mutable list to an immutable one. This is needed when we have declared a list whose items are changeable but after certain steps we want to stop allowing the elements in it to change. In such scenario, we apply the frozenset() function as shown below.SyntaxSyntax: frozenset(iterable_object_name)In the below example we take a list, change its element and print it. Then in the next step we apply the frozenset function, and try changing the element again. In the second step we get the error showing that the list can not be modified anymore.Example# Before applying ...
Read MorePython - end parameter in print()
The print() function in Python automatically adds a newline character () at the end of each print statement. However, you can customize this behavior using the end parameter to specify different ending characters or strings. Syntax print(value1, value2, ..., end='character_or_string') Default Behavior By default, print() ends with a newline character ? print("Welcome to") print("Tutorialspoint") Welcome to Tutorialspoint Using Space as End Character You can replace the newline with a space to print on the same line ? print("Welcome to", end=' ') print("Tutorialspoint") ...
Read MoreHow to Align Labels Next to Inputs?
When designing web forms, aligning labels next to input fields can significantly improve readability and usability. This alignment enhances the form's visual structure, making it easier for users to fill out information. In this article, we'll cover CSS techniques for aligning labels both to the right and left of their respective input fields. Syntax label { display: inline-block; width: value; text-align: left | right; } Basic CSS Properties for Label Alignment The key properties for aligning labels are: PropertyPurposeCommon Values ...
Read MorePython - Difference in keys of two dictionaries
Two Python dictionaries may contain some common keys between them. In this article we will find how to get the difference in the keys present in two given dictionaries. Using Set Difference Here we take two dictionaries and apply set function to them. Then we subtract the two sets to get the difference. We do it both ways, by subtracting second dictionary from first and next subtracting first dictionary from second. Those keys which are not common are listed in the result set ? Example dictA = {'1': 'Mon', '2': 'Tue', '3': 'Wed'} print("1st Dictionary:", ...
Read Morefloor() and ceil() function Python
These two methods are part of python math module which helps in getting the nearest integer values of a fractional number.floor()It accepts a number with decimal as parameter and returns the integer which is smaller than the number itself.SyntaxSyntax: floor(x) Where x is a numeric valueExample of floor()In the below example we take different types of numeric values like, integer, positive decimal and negative decimal and apply the floor function to them. We get the nearest integer which is less than the numeric value supplied.import math x, y, z = 21 , -23.6 , 14.2 print("The value of ", x, ...
Read MoreImage Clip Animation with Sliders using only HTML & CSS
Creating an animated image clip with a slider using only HTML and CSS provides an interactive way to display multiple images with smooth circular clip-path transitions. In this tutorial, we'll create an image carousel where each image reveals with a circular animation effect controlled by stylish radio button sliders. Syntax .element { clip-path: circle(radius at position); transition: clip-path duration ease; } input[type="radio"]:checked ~ .target { clip-path: circle(150% at 0% 100%); } Project Setup You'll need to set up basic HTML and ...
Read MorePython - Create a dictionary using list with none values
Sometimes you need to create a dictionary from a list where each list element becomes a key with a None value. This is useful for creating placeholder dictionaries or initializing data structures. Python provides several methods to achieve this conversion. Using dict.fromkeys() The dict.fromkeys() method creates a dictionary with keys from an iterable and assigns the same value to all keys. By default, it assigns None ? days = ["Mon", "Tue", "Wed", "Thu", "Fri"] print("Given list:") print(days) result = dict.fromkeys(days) print("Dictionary with None values:") print(result) Given list: ['Mon', 'Tue', 'Wed', 'Thu', ...
Read MorePython - Convert given list into nested list
Sometimes we need to convert list elements into individual sublists, creating a nested list structure. Python provides several approaches to achieve this transformation depending on your specific requirements. Using List Comprehension The simplest approach is to wrap each element in a list using list comprehension ? days = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri'] print("Given list:", days) # Convert each element to a sublist nested_list = [[item] for item in days] print("Nested list:", nested_list) Given list: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri'] Nested list: [['Mon'], ['Tue'], ['Wed'], ['Thu'], ['Fri']] Using map() Function ...
Read MoreBroadcasting with NumPy Arrays in Python
Broadcasting is a NumPy feature that allows arithmetic operations between arrays of different shapes without explicitly reshaping them. When arrays have unequal dimensions, NumPy automatically adjusts the smaller array's shape by prepending dimensions of size 1, enabling element-wise operations. Rules of Array Broadcasting NumPy follows these rules when broadcasting arrays ? Arrays with smaller ndim are prepended with dimensions of size 1 in their shape. The output shape in each dimension is the maximum of the input sizes in that dimension. An array can be used in calculation if its size in a particular dimension matches ...
Read MoreInput Label Animation in HTML & CSS
The CSS input label animation creates a smooth floating effect where the label moves to the top border of the input field when the user focuses on or types in the input. This provides better user experience and visual feedback. Syntax /* Basic structure for animated label */ .input-container { position: relative; } label { position: absolute; transition: all 0.3s ease; pointer-events: none; } /* Animation trigger */ input:focus + label, input:not(:placeholder-shown) + label { ...
Read More