Articles on Trending Technologies

Technical articles with clear explanations and examples

CSS transition-duration property

Arjun Thakur
Arjun Thakur
Updated on 24-Jun-2020 101 Views

Use the transition-duration property to set the duration of transition Example             div {       width: 150px;       height: 150px;       background: blue;       transition-property: height;       transition-duration: 2s;      }      div:hover {       height: 200px;      }              Heading One    Hover over the below box to change its height.       

Read More

Build a radial gradient with the shape of a circle

Arjun Thakur
Arjun Thakur
Updated on 23-Jun-2020 274 Views

To create a circle with radial gradient, you can try to run the following code. Set another parameter in radial gradient for shapes like circle Example             #demo {       height: 400px;       background: radial-gradient(circle, red , blue, yellow);      }              Radial Gradient    Radial Gradients   

Read More

Write Python program to find duplicate rows in a binary matrix

Paul Richard
Paul Richard
Updated on 23-Jun-2020 389 Views

Given a binary matrix contains 0 and 1, our task is to find duplicate rows and print it.Python provides Counter() method which is used here.ExampleInput: 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 Output: (1, 1, 1, 1) (0, 0, 0, 0)AlgorithmStep 1: Create a binary matrix, only 0 and 1 elements are present. Step 2: Which will have rows as key and it’s frequency as value. Lists are mutable so first, we will cast each row (list) into a tuple. Step 3: Create a dictionary using the counter method. Step 4: ...

Read More

Python program to check whether a given string is Heterogram or not

Rishi Raj
Rishi Raj
Updated on 23-Jun-2020 2K+ Views

Here one string is given then our task is to check weather a given string is Heterogram or not.The meaning of heterogram checking is that a word, phrase, or sentence in which no letter of the alphabet occurs more than once. A heterogram may be distinguished from a pangram which uses all of the letters of the alphabet.ExampleString is abc def ghiThis is Heterogram (no alphabet repeated)String is abc bcd dfhThis is not Heterogram. (b, c, d are repeated)AlgorithmStep 1: first we separate out list of all alphabets present in sentence. Step 2: Convert list of alphabets into set because ...

Read More

Python program to find Largest, Smallest, Second Largest, and Second Smallest in a List?

karthikeya Boyini
karthikeya Boyini
Updated on 23-Jun-2020 2K+ Views

Array is given, we have to find out maximum, minimum, secondlargest, second smallest number.AlgorithmStep 1: input list element Step 2: we take a number and compare it with all other number present in the list. Step 3: get maximum, minimum, secondlargest, second smallest number.Example code# To find largest, smallest, second largest and second smallest in a List    def maxmin(A):       maxi = A[0]       secondsmax = A[0]       mini = A[0]       secondmini = A[0]       for item in A:    if item > maxi:       maxi ...

Read More

Python code to print common characters of two Strings in alphabetical order

karthikeya Boyini
karthikeya Boyini
Updated on 23-Jun-2020 1K+ Views

Two user input strings are given, our task is to print all the common characters in alphabetical order.ExampleInput: string1: python string2: program Output: opExplanationThe letters that are common between the two strings are o (1 times), p (1 time)AlgorithmStep 1: first we take two input string. Step 2: next we will do to convert these two strings into counter dictionary. Step 3: Now find common elements between two strings using intersection ( ) property. Step 4: Resultant will also be a counter dictionary having common elements as keys and their common frequencies as value. Step 5: Use elements () method ...

Read More

Python program to move spaces to front of string in single traversal

Samual Sam
Samual Sam
Updated on 23-Jun-2020 581 Views

Given a string that has set of words and spaces, our task is to move all spaces to front of string, by traversing the string only once. We will solve this problem quickly in Python using List Comprehension.ExampleInput: string = "python program" Output: string= “ pythonprogram"AlgorithmStep1: input a string with word and space. Step2: Traverse the input string and using list comprehension create a string without any space. Step 3: Then calculate a number of spaces. Step 4: Next create a final string with spaces. Step 5: Then concatenate string having no spaces. Step 6: Display string.Example Code# Function to ...

Read More

String slicing in Python to rotate a string

karthikeya Boyini
karthikeya Boyini
Updated on 23-Jun-2020 5K+ Views

A string is given, our task is to slicing the string into two way. One is clockwise and another anticlockwise.1. Left (Or anticlockwise) rotate the given string by d elements (where d pythonprogram Left Rotation: thonprogrampy Right Rotation: ampythonprogr

Read More

Python Program to calculate n+nm+nmm.......+n(m times).

Samual Sam
Samual Sam
Updated on 23-Jun-2020 608 Views

Here n is given value which is positive number m is the number of times till which the series run. Our task is to calculate this series.AlgorithmStep 1: Input n, m; Step 2: Converting the number to string. Step 3: Initializing result as number and string. Step 4: Adding remaining terms. Step 5: Concatenating the string making n, nn, nnn... Step 6: Before adding converting back to integer. Step 7: return sum.Example Code# Python program to sum the series def sumofseries(n, m):    str1 = str(n)    sum1 = n    sumofstr1 = str(n)    for i in range(1, m): ...

Read More

Specify how nested elements are rendered in 3D space

Vrundesha Joshi
Vrundesha Joshi
Updated on 23-Jun-2020 200 Views

To specify how nested elements are rendered in 3D space, use the transform-style property in CSS. You can try to run the following code to implement the transform-style property: Example             .demo1 {        width: 300px;        height: 300px;        background-color: yellow;      }      .demo2 {        width: 200px;        height: 200px;        background-color: orange;      }      .demo3 {        width: 100px;        height: 100px;        background-color: blue;        transform: rotate(10deg);        transform-origin: 30% 40%;        transform-style: preserve-3d;      }              Rotation    Demo      Demo                  Demo                     

Read More
Showing 48611–48620 of 61,248 articles
Advertisements