To implement animation on the column-gap property with CSS, you can try to run the following code −ExampleLive Demo div { width: 600px; height: 300px; background: white; border: 10px solid red; animation: myanim 3s infinite; bottom: 30px; position: absolute; column-count: 4; ... Read More
In this tutorial, we are going to write a program that combines elements of the same indices different lists into a single list. And there is one constraint here. All the lists must be of the same length. Let's see an example to understand it more clearly.Input[[1, 2, 3], [4, 5, 6], [7, 8, 9]]Output[[1, 4, 7], [2, 5, 8], [3, 6, 9]]We can solve it in different ways. Let's see how to solve with normal loops.Initialize the list with lists.Initialize an empty list.Initialize a variable index to 0.Iterate over the sub list length timesAppend an empty list to the ... Read More
In this tutorial, we are going to write a program that groups all anagrams in a list. First, let's see what are anagrams.Any two strings that have the same character in a different order are known as anagrams.Before diving into the solution, let's see an example.Input['cat', 'dog', 'fired', 'god', 'pat', 'tap', 'fried', 'tac']Output[['cat', 'tac'], ['dog', 'god'], ['fried', 'fired'], ['pat', 'tap']]We will breakdown the problem into two pieces. First, we will write a function that checks two strings are anagrams or not. Follow the below steps to write code to check anagrams.Initialize the strings.Sort both the strings.If both sorted strings are ... Read More
In this tutorial, we are going to write a program that returns a sublist element till nth sublist in a list. Let's say we have the following list with 5 sublists.[['Python', 'Java'], ['C', 'Pascal'], ['Javascript', 'PHP'], ['C#', 'C++'], ['React', 'Angular']] Now, we have to get the first element from the first three sublists. We can get the elements different approaches. Let's see some of them.LoopsMore generic and first thought of the most of programmers is to use loops. Let's see the code using loops.Example Live Demo# initializing the list and N random_list = [['Python', 'Java'], ['C', 'Pascal'], ['Javascript', 'PHP'], ['C# C++'], ... Read More
In this tutorial, we are going to check the congruency of two triangles. We are going to check SSS, SAS, and AAA. The similarity of the triangles is proved based on those criteria.We have to check different conditions based on the theorem. Check them in the code below.Example Live Demodef side_side_side(sides_one, sides_two): # sorting same pace sides_one.sort() sides_two.sort() # checking the conditions if sides_one[0] / sides_two[0] == sides_one[1] / sides_two[1] \ and sides_one[1] / sides_two[1] == sides_one[2] / sides_two[2] \ and sides_one[2] / sides_two[2] == sides_one[0] / sides_two[0]: ... Read More
In this tutorial, we are going to write a program that finds the longest common path from the given list of paths. Let's see an example to understand the problem statement more clearly.Inputpaths = ['home/tutorialspoint/python', 'home/tutorialspoint/c', 'home/tutorialspoint/javascript', 'home/tutorialspoint/react', 'home/tutorialspoint/django']/home/tutorialspoint/We can solve the problem using os module very easily. Let's see the steps to solve theImport the os module.Initialize the list of paths to find the longest common path.Find the common prefix of all paths using os.path.commonprefix(paths) and store it in variable.And extract the directory from the common prefix using os.path.dirname(common_prefix).Example Live Demo# importing the os module import os # initializing the ... Read More
In this section we will see how external RAM memories can be addressed by the Intel 8051 microcontroller. There are different methods for addressing the RAMs. Now at first we will discuss about some different types of RAM memories in short.The RAM (Random Access Memory) is volatile memory. So when the power is cutting off to the RAM chip, it losses the data. RAMs are also known as RAWM (Read and Write Memory). There are basically three kinds of RAMs. These are SRAM (Static RAM), NV-RAM (Non-Volatile RAM) and DRAM (Dynamic RAM).Static RAMThe storage cell in Static RAM are made ... Read More
Selenium 1 or known as RC (Remote Control) and Web Driver differ in many aspects but the key difference comes in the implementation layer or in simple words the architecture of both of them.As name suggest, RC is a Remote Control which works by taking the remote of the browser and then injects the automation code to be tested by injecting the custom scripts written.The Web Driver (known as Selenium 2) works on the browser directly and uses browsers in-built features to trigger the automation test written by tester. Web driver is the successor of Remote Control.The architecture of Selenium ... Read More
Suppose we have an array A of 0s and 1s, consider N[i] is the i-th subarray from index A[0] to A[i] interpreted as a binary number. We have to find a list of boolean answers, where answer[i] is true if and only if N[i] is divisible by 5.So, if the input is like [0, 1, 1, 1, 1, 1], then the output will be [true, false, false, false, true, false]To solve this, we will follow these steps −length := size of Aans:= make an array of size length, and fill with falsenumber:= a binary value by concatenating each element from ... Read More
To change only dates, not time, use the MySQL INTERVAL and YEAR. Since, we will be updating the records, therefore, use UPDATE and set a new value with INTERVAL.Let us see an example and create a table −mysql> create table DemoTable ( DueDate datetime ); Query OK, 0 rows affected (0.56 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('2017-08-12 10 :30 :45'); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable values('2015-09-21 12 :00 :00'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable values('2018-12-31 11 :45 :56'); Query ... Read More