
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 26504 Articles for Server Side Programming

257 Views
When it is required to sort the elements of a circular linked list, a ‘Node’ class needs to be created. In this class, there are two attributes, the data that is present in the node, and the access to the next node of the linked list.In a circular linked list, the head and the rear are adjacent to each other. They are connected to form a circle, and don’t have ‘NULL’ value in the last node.Another ‘linked_list’ class needs to be created that would have an initialization function, and the head of the node would be initialized to ‘None’.Multiple methods ... Read More

385 Views
When it is required to search for an element in a circular linked list, a ‘Node’ class needs to be created. In this class, there are two attributes, the data that is present in the node, and the access to the next node of the linked list.In a circular linked list, the head and the rear are adjacent to each other. They are connected to form a circle, and don’t have ‘NULL’ value in the last node. Another class needs to be created that would have an initialization function, and the head of the node would be initialized to ‘None’.Multiple ... Read More

2K+ Views
When it is required to get the unique elements in a nested tuple, a nested loop and the 'set' operator can be used.Python comes with a datatype known as 'set'. This 'set' contains elements that are unique only.The set is useful in performing operations such as intersection, difference, union and symmetric difference.Below is a demonstration of the same −ExampleLive Demomy_list_1 = [(7, 8, 0), (0 ,3, 45), (3, 2, 22), (45, 12, 9)] print ("The list of tuple is : " ) print(my_list_1) my_result = [] temp = set() for inner in my_list_1: for elem in inner: ... Read More

743 Views
When it is required to multiply adjacent elements, the 'zip' method, the 'tuple' 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, 0 ,3, 45, 3, 2, 22) print ("The tuple is : " ) ... Read More

3K+ Views
When it is required to check if a variable is a tuple, the 'type' method can be used. A tuple is an immutable data type. It means, values once defined can't be changed by accessing their index elements. If we try to change the elements, it results in an error. They are important contains since they ensure read-only access.The 'type' method checks to see the type of the iterable/value that is passed to it as an argument.Below is a demonstration of the same −ExampleLive Demomy_tuple_1 = (7, 8, 0, 3, 45, 3, 2, 22, 4) print ("The tuple is ... Read More

9K+ Views
When it is required to convert a string into a tuple, the 'map' method, the 'tuple' method, the 'int' method, and the 'split' method can be used.The map function applies a given function/operation to every item in an iterable (such as list, tuple). It returns a list as the result.The 'int' method converts the given data type to an integer type, if that operation is permitted.The split method splits the given data into different sections based on a delimiter or a default delimiter. The 'tuple' method converts the given data type into a tuple type.Below is a demonstration of the ... Read More

5K+ Views
When it is required to add a dictionary to a tuple, the 'list' method, the 'append', and the 'tuple' method can be used.A list can be used to store heterogeneous values (i.e data of any data type like integer, floating point, strings, and so on).The 'append' method adds elements to the end of the list.Below is a demonstration of the same −ExampleLive Demomy_tuple_1 = (7, 8, 0, 3, 45, 3, 2, 22, 4) print ("The tuple is : " ) print(my_tuple_1) my_dict = {"Hey" : 11, "there" : 31, "Jane" : 23} print("The dictionary is : ") ... Read More

3K+ Views
When it is required to find the maximum element in a tuple list (i.e. list of tuples), the 'max' method and the 'operator. itemgetter()' method can be used. The itemgetter fetches a specific item from its operand. The 'max()' method gives the maximum value present in an iterable that is passed as an argument to it. Some of the common methods to find the maximum element in a tuple list are as follows. 'itemgetter()' function: Used for retrieving items from an iterable object such as a ... Read More

203 Views
When it is required to chunk the tuples to 'N' values, list comprehension is used.The list comprehension is a shorthand to iterate through the list and perform operations on it.Below is a demonstration of the same −ExampleLive Demomy_tuple_1 = (87, 90, 31, 85, 34, 56, 12, 5) print("The first tuple is :") print(my_tuple_1) N = 2 print("The value of 'N' has been initialized") my_result = [my_tuple_1[i : i + N] for i in range(0, len(my_tuple_1), N)] print("The tuple after chunking is : ") print(my_result)OutputThe first tuple is : (87, 90, 31, 85, 34, 56, 12, 5) The ... Read More

215 Views
When it is required to access the front and rear elements of a Python tuple, the access brackets can be used.A tuple is an immutable data type. It means, values once defined can't be changed by accessing their index elements. If we try to change the elements, it results in an error. They are important contains since they ensure read-only access.Below is a demonstration of the same −ExampleLive Demomy_tuple_1 = (87, 90, 31, 85, 34, 56, 12, 5) print("The first tuple is :") print(my_tuple_1) my_result = (my_tuple_1[0], my_tuple_1[-1]) print("The front and rear elements of the tuple are ... Read More