Programming Articles - Page 2458 of 3363

Introduction-to-convolutions-using-python

Pavitra
Updated on 29-Aug-2019 11:47:42

324 Views

In this article, we will learn about convolutions in Python 3.x. Or earlier. This articles come under neural networks and feature extraction.Ide preferred − Jupyter notebookPrerequisites − Numpy installed, Matplotlib installedInstallation>>> pip install numpy >>>pip install matplotlibConvolutionConvolution is a type of operation that can be performed on an image to extract the features from it by applying a smaller container called a kernel/coordinate container like a sliding window over the image. Depending on the values in the convolutional coordinate container, we can pick up specific patterns/features from the image.Here, we will learn about the detection of horizontal and vertical endpoints in ... Read More

Internal working of Set in Python

Pavitra
Updated on 29-Aug-2019 11:43:38

473 Views

In this article, we will learn about the Internal working of Set in Python. We will observe the union and intersection operation in different frames and objects.Let’s declare an empty set.>>> s=set()Now let’s declare a set with elements.>>> s1=set('tutorialspoint')Adding an element into an empty set.>>> s.add(‘p’)Now we declare another set with the name of Python.>>> s2=set('python')Now let’s see the union operation.>>> s3=s1.union(s2)Finally, we implement the intersection option.>>> s4=s1.intersection(s2)ConclusionIn this article, we learned about the Internal working of Set in Python 3.x. Or earlierRead More

Internal working of Python

Pavitra
Updated on 29-Aug-2019 11:38:09

2K+ Views

In this article, we will learn about the internal working of python & how different objects are allocated space in the memory by the python interpreter.Python is an object-oriented programming construct language like Java. Python uses an interpreter and hence called an interpreted language. Python supports minimalism and modularity to increase readability and minimize time and space complexity. The standard implementation of python is called “cpython” and we can use c codes to get output in python.Python converts the source code into a series of byte codes. So within python, compilation stage happens, but directly into byte code and this ... Read More

Internal working of the list in Python

Pavitra
Updated on 29-Aug-2019 11:34:57

364 Views

In this tutorial, we will learn about the internal working of the list in Python 3.x. Or earlier. We will also look at the object and frame formation when we write a python statement at each step.Initializing the list: This means that we are creating a list with some elements.>>> lis=[1, 2, 3, 4]Here list variable is declared in the global frame which is referring to a list object as shown aboveNow let’s see what happened when we append the element in the list.>>> lis.append(8)Here the element is added at the end and the size of the list is increased ... Read More

Interesting Python Implementation for Next Greater Elements

Pavitra
Updated on 29-Aug-2019 11:27:10

178 Views

In this article, we will learn about defining and user-defined functions to predict the next greatest element.Problem statementWe are given an array & we need to print the Next Greater Element for every element present in the array. The Next greater Element for an arbitrary element y is the first greatest element present on the right side of x in array. Elements for which no greatest element exist, return -1 as output.4Input test case[12, 1, 2, 3]Output12 -> -1 1 -> 3 2 -> 3 3 -> -1Now let’s observe the source code.Example# Function Def elevalue(arr):    # Iteration   ... Read More

How can we disable the leaf of JTree in Java?

raja
Updated on 03-Jul-2020 05:46:15

430 Views

A JTree is a component that presents a hierarchical view of data. The user has the ability to expand or collapse individual sub-trees. A TreeNode interface defines the methods that must be implemented nodes of a JTree object. The DefaulMutableTreeNode class provides a default implementation of a TreeNode interface. We can disable the leaf of JTree by overriding the getTreeCellRendererComponent() method of DefaultTreeCellRenderer class.Syntaxpublic Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus)Exampleimport java.awt.*; import javax.swing.tree.*; import javax.swing.*; public class JTreeLeafNodeDisableTest extends JFrame {    private TreeNode treeNode;    private JTree tree;    public JTreeLeafNodeDisableTest() {       setTitle("JTreeLeafNodeDisable Test");     ... Read More

issubset() function in Python

Pavitra
Updated on 29-Aug-2019 11:17:28

336 Views

In this article, we will learn the implementation and usage of issubset() function available in the Python Standard Library.The issubset() method returns boolean True when all elements of a set are present in another set (passed as an argument) otherwise, it returns boolean False.In the figure given below B is a subset of A. In case A & B are identical sets mean that A is a proper subset of B. This means both sets contain the same elements in them.Syntax.issubset()Return valueboolean True/FalseNow let’s look at an illustration to understand the concept.Example Live DemoA = {'t', 'u', 't', 'o', 'r', 'i', ... Read More

Input/Output from external file in C/C++, Java and Python for Competitive Programming

Pavitra
Updated on 29-Aug-2019 11:23:15

460 Views

In this article, we will learn about Input/Output from an external files in C/C++, Java, and Python for Competitive Programming.Python I/O from the fileIn python, the sys module is used to take input from a file and write output to the file. Let’s look at the implementation in the form of code.Exampleimport sys # For getting input sys.stdin = open('sample.txt', 'r') # Printing the Output sys.stdout = open('sample.txt', 'w')Java I/O from the fileHere we take the help of buffered reader method to take input associated with file reader to read input from file and print writer to print the data ... Read More

IDE for Python programming on Windows

Pavitra
Updated on 29-Aug-2019 10:54:28

421 Views

In this article, we will learn about different IDE’s available on Python for windows.PycharmInteractive python consoleSupport for web frameworksFaster refracting timeLesser developmentJupyter notebookCompatibility with almost every python moduleLesser space and hardware requirementsInbuilt terminal and kernel featuresA wide variety of widgets can be appliedWing ideInbuilt debugging toolsSupport for unit testingEasy code navigation capability.Komodo ideThird-party library supportXML autocompletionInbuilt refracting capacity.Sublime textCross-platformMultitaskingBetter customizationAtomBetter customizationBetter user interfaceCross-platform editorConclusionIn this article, we learned about IDE for Python programming on windows.

issuperset() in Python

Pavitra
Updated on 29-Aug-2019 10:48:29

174 Views

In this article, we will learn about issuperset() in Python and its implementation in various areas.This method returns boolean True if all elements of a set B contains all elements set A which is passed as an argument and returns false if all elements of A not present in B.This means if B is a superset of A then itreturns true; else FalseExampleLet’s look at some example Live DemoA = {'t', 'u', 't', 'o', 'r', 'i', 'a', 'l'} B = {'t', 'u', 't'} print("A issuperset B : ", A.issuperset(B)) print("B issuperset A : ", B.issuperset(A))OutputA issuperset B : True B issuperset ... Read More

Advertisements