
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 10476 Articles for Python
6K+ Views
In Python, searching for elements within a data structure is a common task and different types of data structures should aim to provide efficient methods for searching. The problem of searching involves finding a specific element within a container and returning a value if it is not found. One data structure that can be used for this task is a tuple, which stores a collection of different types of data in a single variable. These items can be accessed by their index and Python offers various methods to work with them. Tuples are immutable, meaning that once created, they cannot ... Read More
1K+ Views
One of the most common problems in computer science is the problem of searching. To check whether a given element exists in a variable is important and sometimes the item we must search for, can be the maximum, minimum, most frequent etc. in this article we will see how we can find the largest element in a tuple. We know that tuple is a pre-defined datatype that stores heterogenous data. It is sort of a container that holds several items inside it. We can define a tuple in python using the round brackets enclosing the data that we ... Read More
7K+ Views
Tuples are an important data type in Python and are often used to store a fixed set of elements. In this article, we will be discussing how to pass a tuple as function arguments in Python. We will go over the syntax for passing tuple arguments and will provide examples of how to do so. Let us first understand the basics that, we will be needing to begin approaching the problem. The problem asks us to pass a tuple as a function argument, for that we need to know what a function in python is, what are function arguments, ... Read More
4K+ Views
In Python, tuples are an immutable sequence type that is commonly used to store a collection of items. We can define a tuple in python using the round brackets enclosing the data that we wish to store − Var = (1, ‘a’, 3.7) There are times when we must use a single variable that has the elements of two or more different tuples. In those cases, we must know the ways we can merge them to create a single variable. In this article, we will be discussing how to merge two tuples in Python. Using + ... Read More
3K+ Views
In Python, it is often necessary to check if a tuple is empty in order to determine what actions to take in a program. A tuple in python is a pre-defined datatype that stores heterogeneous data, data of different types, in a single variable. The items can be indexed for further operations and python provides a wide array of methods to work upon them. They are immutable by nature which means we cannot make changes after we have created a tuple. This is whenever we perform some operation on the tuple a new tuple with resulting values is created. ... Read More
3K+ Views
In Python, tuples are immutable, meaning that once they are created, their elements cannot be modified. However, there may be times when you need to add elements to a tuple. In this article, we will be discussing how to add elements to a tuple in Python. We will go over the syntax for adding elements to a tuple and will provide examples of how to do so. Python tuples are very similar to Python lists, in that you can perform all the various operations that can be performed on lists. The only difference is that tuples cannot be modified after ... Read More
512 Views
In Python, a linked list is a linear data structure that consists of a chain of nodes, where each node contains a value and a reference to the next node in the chain. In this article, we will be discussing how to add an element to the first and last position of a linked list in Python. Linked List in Python A linked list is a referential data structure that holds a group of elements. it is similar in terms of an array but while the data is stored in contiguous memory location in an array, in linked ... Read More
223 Views
In this article, we will be discussing how to sort a tuple by values in Python. A tuple is a data structure that is similar to a list, but it is immutable, meaning that once it is created, we cannot change the values of the elements within it. Example Following is an example to create a tuple – tple = ("Hello", "world", "hi") print(tple) Output (“Hello”, “world”, “hi”) Ordered, immutable triple items can have multiple values. An index of [0] is assigned to the first item in a triple, [1] to the second, and so on. When we ... Read More
5K+ Views
In this article, we will be discussing how to remove duplicate elements from a dictionary in Python. A dictionary is a data structure that stores key-value pairs, and it is an essential data type to understand when learning Python. However, there may be cases where we have a dictionary with duplicate elements, and we want to remove them to clean up the data. We can declare a dictionary in the following way − thisdict = { "brand": "Ford" , "model": "Mustang" , "year": 1964 } However, a dictionary can contain duplicate value for different keys, but we might ... Read More
2K+ Views
In Python, tuples are a useful data type for storing a collection of items. Sometimes, it may be necessary to print the keys and values of a tuple in order to understand or debug your code. In this article, we will be discussing, how to print the keys and values of a tuple in Python. We will go over the syntax for accessing these elements and will provide examples of how to do so. First, we will learn about what is tuple and what we mean by the keys and values of the tuple. What does a Python tuple mean? ... Read More