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
Programming Articles - Page 1342 of 3366
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
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
408 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
288 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
255 Views
When it is required to find the minimum 'k' records from a list of tuples, it can be done using the 'sorted' method and lambda function.The 'sorted' method is used to sort the elements of a list. Anonymous function is a function which is defined without a name.In general, functions in Python are defined using 'def' keyword, but anonymous function is defined with the help of 'lambda' keyword. It takes a single expression, but can take any number of arguments. It uses the expression and returns the result of it.A list can be used to store heterogeneous values (i.e data ... Read More
4K+ Views
A matrix in Python is a two-dimensional array having a specific number of rows and columns. The data elements in Python matrix can be numbers, strings or symbols etc.Matrix or two-dimensional list is an important data structure. Various operations associated with matrix involve transpose, addition or multiplication of two matrices.We will discuss how to declare a matrix in python with a specific number of rows and columns and then input data items from the user and finally print the matrix.Declare a matrix in Python as nested listA matrix in Python can be declared as a nested list. The number of ... Read More
645K+ Views
Tkinter is a standard library in Python which is used for GUI application. Tkinter has various controls which are used to build a GUI-based application.To install Tkinter, we need Python pre-installed. Tkinter actually comes along when we install Python. While installing Python, we need to check the td/tk and IDLE checkbox. This will install the tkinter and we need not install it separately.However, if we missed installing Tkinter while installing Python, we can do it later using the pip command.Step 1 − Make sure Python and pip is preinstalled on your systemType the following commands in command propmt to check ... Read More
965 Views
A list in Python is a linear data structure where elements are stored in contiguous memory locations and elements are accessed by their indexes.We may sometimes need to remove an element from a list in Python. There are various inbuilt functions to achieve this.pop()This deletes or removes the element at the index passed as an argument in pop().Example Live Demolst=[1, 2, 3, 4, 5] lst.pop(2) print(lst)Output[1, 2, 4, 5]The above code snippet shows that the pop(2) removes the element at index 2.remove()This function removes the first occurrence of the element passed as argument in remove().Example Live Demolst=[1, 2, 3, 2, 4, 5] ... Read More
368 Views
If it is required to find the maximum of the similar indices in two list of tuples, the 'zip' method and list comprehension can be used.The list comprehension is a shorthand to iterate through the list and perform operations on it.The zip method takes iterables, aggregates them into a tuple, and returns it as the result.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_1 = [( 67, 45), ... Read More
186 Views
If it is required to check if a tuple contains a specific value 'K', it can be done using the 'any' method, the 'map' method and the lambda function.Anonymous function is a function which is defined without a name. In general, functions in Python are defined using 'def' keyword, but anonymous function is defined with the help of 'lambda' keyword. It takes a single expression, but can take any number of arguments. It uses the expression and returns the result of it.The map function applies a given function/operation to every item in an iterable (such as list, tuple). It returns ... Read More