
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
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
Found 10400 Articles for Python

941 Views
The Template matching is a technique, by which a patch or template can be matched from an actual image. This is basically a pattern matching mechanism. In Python there is OpenCV module. Using openCV, we can easily find the match. So in this problem, the OpenVC template matching techniques are used. To use the OpenCV functionality, we need to download them using pip. sudo pip3 install opencv-python For template matching task, there is an accuracy factor, this factor is known as threshold. As an example, we can say that we can easily create face recognizing scheme using this ... Read More

6K+ Views
In Python, the Fraction module supports rational number arithmetic. Using this module, we can create fractions from integers, floats, decimals, and other numeric values and strings. The constructor of this class accepts Numerator and Denominator as parameters and creates Fractions from them. The default value of the numerator is 0 and the default value of the denominator is 1. The cost raises ZeroDivisionError when the denominator is 0. Creating Fraction Instances At first, we will see how the class can create fractions using Numerator and Denominator. Example from fractions import Fraction as frac print(frac(45, 54)) print(frac(12, 47)) print(frac(0, 15)) ... Read More

2K+ Views
In different programming languages, First Class objects are those objects, which can be handled uniformly. First Class objects can be stored as Data Structures, as some parameters of some other functions, as control structures etc. We can say that a function in Python is First Class Function, if it supports all of the properties of a First Class object. What are the properties of First Class Functions? It is an instance of an Object type Functions can be stored as variable Pass First Class Function as argument of some other functions Return Functions from other function Store Functions in ... Read More

3K+ Views
The WordNet is a part of Python's Natural Language Toolkit. It is a large word database of English Nouns, Adjectives, Adverbs and Verbs. These are grouped into some set of cognitive synonyms, which are called synsets. To use the Wordnet, at first we have to install the NLTK module, then download the WordNet package. $ sudo pip3 install nltk $ python3 >>> import nltk >>>nltk.download('wordnet') In the wordnet, there are some groups of words, whose meaning are same. In the first example, we will see how wordnet returns meaning and other details of a word. Sometimes, if some ... Read More

903 Views
Sometimes we need to use more than one condition checking in a single statement. There are some basic syntax for these kind of checking is x < y < z, or if x < y and x < z etc. Like other languages, there are some basic comparison operators in Python. These comparison operators are =, ==, !=, is, is not, in, not in. The precedence of these operators are same, and the precedence is lesser than arithmetic, bitwise and shifting operators. These operators can be arranged arbitrarily. They will be used as a chain. So for an example, if ... Read More

1K+ Views
To quickly convert Decimal to other based, we will be using the Built-in functions in Python − Decimal to Binary − bin() Decimal to Octal − oct() Decimal to Hexadecimal − hex() Decimal number system has base 10 as it uses 10 digits from 0 to 9. In decimal number system, the successive positions to the left of the decimal point represent units, tens, hundreds, thousands, and so on. Binary uses two digits, 0 and 1. Also called as base 2 number system Each position in a binary number represents a 0 power of the base (2). Last ... Read More

644 Views
The photomosaic is a technique, where we can split our image into a grid of squares. Each square will be replaced by some other images or colors. So when we want to see the actual image from a certain distance, we can see the actual image, but if we come closer, we can see the grid of different colored blocks. In this case we are using a Python module called photomosaic. Using this module, we can easily create some photomosaics. To install it please follow this link. It will also download the scikit learn module. sudo pip3 install photomosaic ... Read More

862 Views
UUID is having the full form Universal Unique Identifier, it is a python library which supports 128 bits ids for generating random objects. Advantages of UUID As discussed, we can use it to generate unique random id for random objects. For cryptography and hashing applications, this id can be used. For generating random documents and also addresses etc. this id can be used. Method1 Using uuid1() Example code import uuid print ("Random id using uuid1() is : ", end="") print (uuid.uuid1()) Output Random id using uuid1() is : 4adeede2-e5d8-11e8-bd27-185e0fd4f8b3 Representations of uuid1() bytes − ... Read More

441 Views
We know that when we solve any image related problem, we have to take a matrix. The matrix content will vary depending upon the image type - either it would be a binary image(0, 1), gray scale image(0-255) or RGB image(255 255 255). So if we want to add of two images then that means very simple we have to add respective two matrices. In OpenCV library, we have a function cv2.add() to add the images. But for image addition the size of the two images should be same. Addition of two images import cv2 # Readingour Image1 my_firstpic ... Read More

673 Views
This is a method in image processing to do contrast adjustment using the image's histogram. Actually this method usually increases the global contrast of many images, especially when the usable data of the image is represented by close contrast values and through this adjustment, the intensities can be better distributed on the histogram and it allows for areas of lower local contrast to gain a higher contrast. OpenCV has a function to do this, cv2.equalizeHist() and its input is just grayscale image and output is our histogram equalized image. This technique is good when histogram of the image is confined ... Read More