Harshit Sachan has Published 37 Articles

Python Program to pass the tuple as function arguments

Harshit Sachan

Harshit Sachan

Updated on 17-Feb-2023 14:34:03

4K+ 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 ... Read More

Python Program to Merge two Tuples

Harshit Sachan

Harshit Sachan

Updated on 17-Feb-2023 14:29:44

3K+ 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 ... Read More

Python Program to check if the tuple is empty

Harshit Sachan

Harshit Sachan

Updated on 17-Feb-2023 14:28:34

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 ... Read More

Python Program to add elements to a Tuple

Harshit Sachan

Harshit Sachan

Updated on 17-Feb-2023 14:27:44

1K+ 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 ... Read More

Python Program to Sort a Tuple By Values

Harshit Sachan

Harshit Sachan

Updated on 17-Feb-2023 14:26:38

121 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 ... Read More

Python Program to remove duplicate elements from a dictionary

Harshit Sachan

Harshit Sachan

Updated on 17-Feb-2023 14:25:35

3K+ 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 ... Read More

Python program to print the keys and values of the tuple

Harshit Sachan

Harshit Sachan

Updated on 17-Feb-2023 14:24:30

1K+ 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 ... Read More

Python Program to print elements of a tuple

Harshit Sachan

Harshit Sachan

Updated on 17-Feb-2023 14:23:09

15K+ Views

In Python, tuples are an important data type for storing a collection of items. Sometimes, it may be necessary to print the elements of a tuple in order to understand or debug your code. In this article, we will be discussing how to print the elements of a tuple in ... Read More

Python Program to create a Tuple using tuple literal

Harshit Sachan

Harshit Sachan

Updated on 17-Feb-2023 14:19:35

574 Views

In Python, a tuple is an immutable sequence type that is commonly used to store a collection of items. A python tuple is very similar to a list in python in terms of nesting, indexing and repetition but one difference is that a tuple is immutable whereas the list is ... Read More

Python Program to compare elements in two dictionaries

Harshit Sachan

Harshit Sachan

Updated on 17-Feb-2023 14:17:56

1K+ Views

Dictionaries are a powerful data type in Python that allow you to store data as key-value pairs. In this article, we will be discussing how to compare elements in two dictionaries in Python. We will go over the syntax for comparing dictionary elements and will provide examples of how to ... Read More

Advertisements