 
 Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Programming Articles - Page 2498 of 3366
 
 
			
			257 Views
In this article, we will learn about how we can implement isdisjoint() function on set() data type. This function checks whether the sets passed as arguments have any element in common . In case any element is found, False is returned and True otherwise.The isdisjoint() function can take lists, tuples & dictionaries as input arguments in addition to set inputs. THses types are implicitly converted to set type by the Python interpreter.Syntax.isdisjoint()Return valueBoolean True/FalseNow let’s consider an illustration related to the implementationExample#declaration of the sample sets set_1 = {'t', 'u', 't', 'o', 'r', 'i', 'a', 'l'} set_2 = {'p', 'o', ... Read More
 
 
			
			198 Views
In this article, we will learn about the iintersection_update() in Python to find out common elements in n arrays.The problem is that we are given an array containing lists, find all common elements in given arrays?Algorithm1.Initializingres with the first list inside the array 2.Iterating through the array containing lists 3.Updating the res list by applying intersection_update() function to check the common elements. 4.Finally returning the list and display the output by the help of the print statement.Now let’s take a look at its implementationExampledef commonEle(arr): # initialize res with set(arr[0]) res = set(arr[0]) # new value will get ... Read More
 
 
			
			260 Views
In this article, we will learn about intersection() function that can be performed on any given set. According to mathematics intersection means finding out common elements from the two sets.Syntax.intersection( ……..)Return Value common elements in sets passed as arguments.Exampleset_1 = {'t', 'u', 't', 'o', 'r', 'i', 'a', 'l'} set_2 = {'p', 'o', 'i', 'n', 't'} set_3 = {'t', 'u', 't'} #intersection of two sets print("set1 intersection set2 : ", set_1.intersection(set_2)) # intersection of three sets print("set1 intersection set2 intersection set3 :", set_1.intersection(set_2, set_3))Outputset1 intersection set2 : {'i', 'o', 't'} set1 intersection set2 intersection set3 : {'t'}Explanation Here a search is made ... Read More
 
 
			
			1K+ Views
The append() and extend() functions are used with the python list to increase its number of elements. But the two have different behaviors as shown below.append()Syntax: list_name.append(‘value’) It takes only one argument.This function appends the incoming element to the end of the list as a single new element. Even if the incoming element is itself a list, it will increase the count of the original list by only one.Examplelist = ['Mon', 'Tue', 'Wed' ] print("Existing list", list) # Append an element list.append('Thu') print("Appended one element: ", list) # Append a list list.append(['Fri', 'Sat']) print("Appended a list: ", list)OutputRunning the ... Read More
 
 
			
			723 Views
In this article, we will learn about the intersection of two arrays in Python with the help of Lambda expression and filter function.The problem is that we are given two arrays we have to find out common elements in both of them.Algorithm1. Declaring an intersection function with two arguments. 2. Now we use the lambda expression to create an inline function for selection of elements with the help of filter function checking that element is contained in both the list or not. 3. Finally, we convert all the common elements in the form of a list by the help of ... Read More
 
 
			
			2K+ Views
In Pandas a DataFrame is a two-dimensional data structure, i.e., data is aligned in a tabular fashion in rows and columns. We can create a DataFrame using list, dict, series and another DataFrame. But when we want to add a new row to an already created DataFrame, it is achieved through a in-built method like append which add it at the end of the DataFrame. In this article we will find ways to add the new row DataFrame at the top of the DataFrame using some tricks involving the index of the elements in the DataFrame.ExampleLet's first create a new ... Read More
 
 
			
			268 Views
In this article, we will learn about some of the inplace operators available in Python 3.x. Or earlier.Python provides methods to perform inplace operations, i.e assignment and computation simultaneously using in a single statement with the help of “operator” module. Here we will discuss about ixor(), iand(), ipow() functions .ixor()This function allows us to assign and xor current value. This operation behaves like “a^=b” operation. Assigning can’t be performed in case of immutable data types, such as strings and tuples.Exampleimport operator as op # using ixor() to xor int1 = op.ixor(786, 12); # displaying value print ("The value ... Read More
 
 
			
			2K+ Views
This article will discuss how to implement a Queue using a Stack in Java. It will briefly introduce the Queues and Stacks, and provide a suitable example that shows their implementation. Queues in Java In Java, the Queue class extends the Collection interface, and it supports the insert and remove operations using a FIFO (First-in-First-Out). The last element added to the end of the queue can become the first element to be removed from the queue. The following diagram will give you a better understanding of the Queue: Stacks in Java In Java, a Stack is a subclass (child class) ... Read More
 
 
			
			858 Views
In statistics, the term "frequency" indicates the number of occurrences of a value in a given data sample. As a software meant for mathematical and scientific analysis, Pandas has many in-built methods to calculate frequency from a given sample.Absolute Frequency It is same as just the frequency where the number of occurrences of a data element is calculated. In the below example, we simply count the number of times the name of a city is appearing in a given DataFrame and report it out as frequency.Approach 1 − We use the pandas method named .value_counts.Exampleimport pandas as pd # Create ... Read More
 
 
			
			3K+ Views
In this article, we will learn about how we can initialize matrix using two dimensional list in Python 3.x. Or earlier.Let’s see the intuitive way to initialize a matrix that only python language offers. Here we take advantage of List comprehension. we initialise the inner list and then extend to multiple rows using the list comprehension.Example# input the number of rows N = 3 # input the number of columns M = 3 # initializing the matrix res = [ [ i*j for i in range(N) ] for j in range(M) ] # printing the matrix on screen row ... Read More