Found 26504 Articles for Server Side Programming

How to install matplotlib in Python?

pawandeep
Updated on 31-Aug-2023 01:39:31

177K+ Views

Matplotlib is a Python library that helps to plot graphs. It is used in data visualization and graphical plotting.To use matplotlib, we need to install it.Step 1 − Make sure Python and pip is preinstalled on your systemType the following commands in the command prompt to check is python and pip is installed on your system.To check Pythonpython --versionIf python is successfully installed, the version of python installed on your system will be displayed.To check pippip -VThe version of pip will be displayed, if it is successfully installed on your system.Step 2 − Install MatplotlibMatplotlib can be installed using pip. ... Read More

How to install OpenCV in Python?

pawandeep
Updated on 26-Aug-2023 03:08:57

34K+ Views

OpenCV is a Python library that is used to solve computer vision problems. Computer vision include understanding and analyzing digital images by the computer and process the images or provide relevant data after analyzing the image.OpenCV is an open-source library used in machine learning and image processing. It performs tasks such as recognizing handwritten digits, human faces, and objects.To use OpenCV, we need to install it.Step 1 − Make sure Python and pip is preinstalled on your systemType the following commands in command prompt to check is python and pip is installed on your system.To check Pythonpython --versionIf Python is ... Read More

Tuple XOR operation in Python

AmitDiwan
Updated on 11-Mar-2021 09:45:54

411 Views

When it is required to perform 'XOR' operations on the elements of one tuple, the 'zip' method and the generator expression can be used.The zip method takes iterables, aggregates them into a tuple, and returns it as the result.Generator is a simple way of creating iterators. It automatically implements a class with '__iter__()' and '__next__()' methods and keeps track of the internal states, as well as raises 'StopIteration' exception when no values are present that could be returned.Below is a demonstration of the same −ExampleLive Demomy_tuple_1 = ( 7, 8, 3, 4, 3, 2) my_tuple_2 = (9, 6, 8, 2, ... Read More

Raise elements of tuple as power to another tuple in Python

AmitDiwan
Updated on 11-Mar-2021 09:45:43

304 Views

When it is required to raise the elements of one tuple, as a power of another tuple, the 'zip' method and the generator expression can be used.The zip method takes iterables, aggregates them into a tuple, and returns it as the result.Generator is a simple way of creating iterators. It automatically implements a class with '__iter__()' and '__next__()' methods and keeps track of the internal states, as well as raises 'StopIteration' exception when no values are present that could be returned.Below is a demonstration of the same −ExampleLive Demomy_tuple_1 = ( 7, 8, 3, 4, 3, 2) my_tuple_2 = (9, ... Read More

Concatenation of two String Tuples in Python

AmitDiwan
Updated on 11-Mar-2021 09:45:03

1K+ Views

When it is required to concatenate two string tuples, the 'zip' method and the generator expression can be used.The zip method takes iterables, aggregates them into a tuple, and returns it as the result.Generator is a simple way of creating iterators. It automatically implements a class with '__iter__()' and '__next__()' methods and keeps track of the internal states, as well as raises 'StopIteration' exception when no values are present that could be returned.Below is a demonstration of the same −ExampleLive Demomy_tuple_1 = ('Jane', 'Pink', 'El') my_tuple_2 = ('Will', 'Mark', 'Paul') print ("The first tuple is : " ) print(my_tuple_1) ... Read More

How to Convert Text to Speech in Python?

pawandeep
Updated on 11-Mar-2021 09:35:03

977 Views

Converting Text to Speech basically refers to a program where you give input as a text and the output you receive is the input text in the form of a speech.Python offers the text to speech conversion with the help of APIs. One such API which serves this purpose is the Google Text to Speech API , known as gTTS. The gTTS enables to conversion the provided text into speech and save the output as audio.Step 1 − Install gTTSTo use the gTTS Text to speech conversion tool, we need to install it first. Installing the gTTS is pretty easy.Open ... Read More

What is an object in Python? Explain with examples

pawandeep
Updated on 11-Mar-2021 09:34:41

4K+ Views

A python is an object-oriented programming language. Almost everything in Python is considered as an object. An object has its own properties(attributes) and behavior(methods).A class is a blueprint of the objects or can be termed as object constructor for creating objects.One class can have many objects and value of properties for different objects can be different.Example of properties and behavior of an objectLet’s take the example of car as an object. Its properties will include its color, company name, year of manufacture , price , mileage etc. The behavior of the car will include the functions it can perform, this ... Read More

Explain Merge Sort in Python

pawandeep
Updated on 11-Mar-2021 09:34:13

1K+ Views

Merge sort is a sorting technique. It is an efficient sorting algorithm with a time complexity of (n logn) where n is the length of the array to be sorted.Merge sort is an algorithm that follows the Divide and Conquers paradigm. It continuously divides the array into two equal halves. Later it starts sorting the lists having a single element each and continuously merges the sorted lists to form the complete sorted list.Hence, we obtain a sorted array.ExampleThe purple boxes and black arrows show the splitting of the list into two halves.The green boxes and red arrows show the merging ... Read More

Get minimum difference in Tuple pair in Python

AmitDiwan
Updated on 11-Mar-2021 09:33:38

399 Views

When it is required to get the minimum different in a tuple pair from a list of tuples, it can be done using the 'min' method and the list comprehension.The list comprehension is a shorthand to iterate through the list and perform operations on it. The 'min' method returns the minimum of values among an iterable.A list can be used to store heterogeneous values (i.e data of any data type like integer, floating point, strings, and so on).A list of tuple basically contains tuples enclosed in a list.Below is a demonstration of the same −ExampleLive Demomy_list = [( 67, 78), ... Read More

Get maximum of Nth column from tuple list in Python

AmitDiwan
Updated on 11-Mar-2021 09:33:11

280 Views

When it is required to get the maximum of 'N'th column from a list of tuples, it can be done using list comprehension and 'max' method.The list comprehension is a shorthand to iterate through the list and perform operations on it. The 'max' method returns the maximum of values among an iterable.A list can be used to store heterogeneous values (i.e data of any data type like integer, floating point, strings, and so on).A list of tuple basically contains tuples enclosed in a list.Below is a demonstration of the same −ExampleLive Demomy_list = [( 67, 78, 39), (34, 23, 52), ... Read More

Advertisements