Sayantan's Blog On Python Programming

PYTHON TOUPLES

PYTHON TOUPLES

PYTHON TUPLE SHALLOW COPY

PYTHON TUPLE SHALLOW COPY INTRODUCTION There are two types of copy operations are available in Python. In this article we will discuss on SHALLOW copy operations. Shallow copy operation represents that if we change or modify any of the tuple then the other tuple will also be impacted. There are several ways we can create …

PYTHON TUPLE SHALLOW COPY Read More »

REOVING TUPLE DUPLICATES USING SET

REOVING TUPLE DUPLICATES USING SET INTRODUCTION We can remove duplicate elements by using python set() operator. REMOVING DUPLICATES IN STRING TUPLE We can remove duplicates using set() operator in Python. REOVING TUPLE DUPLICATES USING SET : Output In the above example we can see that the field “Python” was appeared thrice in the tuple. But …

REOVING TUPLE DUPLICATES USING SET Read More »

PYTHON TUPLE BUILT-IN FUNCTIONS

PYTHON TUPLE BUILT-IN FUNCTIONS INTRODUCTIONS Python provides some useful built-in functions which can be used while working with tuples. len() FUNCTION len() function returns the no of fields present in a tuple including duplicates. PYTHON TUPLE BUILT-IN FUNCTIONS : Output count() FUNCTION count() function returns the number of occurrences of an field in a given …

PYTHON TUPLE BUILT-IN FUNCTIONS Read More »

PYTHON TUPLE SORTING OPERATIONS

PYTHON TUPLE SORTING OPERATIONS INTRODUCTIONS Python tuples can be sorted either in forward or backward direction by using below methods: sorted() FUNCTION Sorting an integer tuple sorted() FUNCTION helps us to sort the tuple in ascending order. PYTHON TUPLE SORTING OPERATIONS : Output Sorting a string tuple PYTHON TUPLE SORTING OPERATIONS : Output Sorting a …

PYTHON TUPLE SORTING OPERATIONS Read More »

ZIP FUNCTION IN PYTHON TUPLE

ZIP FUNCTION IN PYTHON TUPLE INTRODUCTION zip() function in python tuple, takes input from two or more tuple and returns a zipped object which can be converted into a combined tuple, list or dictionary. In zipped object the corresponding index field of a tuple will be paired with the same index field of other tuples. …

ZIP FUNCTION IN PYTHON TUPLE Read More »

IMMUTABILITY OF TUPLE IN PYTHON

IMMUTABILITY OF TUPLE IN PYTHON INTRODUCTION Tuple in python are immutable in nature. It means that once a tuple is created can not be changed or updated. Updating a Tuple Updating a primitive type inside a Tuple We can not update a tuple. If we try then python will raise error. IMMUTABILITY OF TUPLE IN …

IMMUTABILITY OF TUPLE IN PYTHON Read More »

STEP SIZE IN PYTHON TUPLE SLICING

STEP SIZE IN PYTHON TUPLE SLICING Step size allows us to put filter on sliced data. POSITIVE STEP SIZE IN TUPLE SLICING Syntax : [start_index : end_index : setp_size] STEP SIZE IN PYTHON TUPLE SLICING : Output STEP SIZE IN PYTHON TUPLE SLICING : Output In the above example, we have used the complete list …

STEP SIZE IN PYTHON TUPLE SLICING Read More »

PYTHON TOUPLE SLICING OPERATION

PYTHON TOUPLE SLICING OPERATION INTRODUCTION Before understanding slicing operation lets look at some tuple accessing methods by using index values. PYTHON TOUPLE SLICING OPERATION : Output In the above example, we have used positive index as well as negative index. Negative index will be counted from the end of the tuple. In the above case, …

PYTHON TOUPLE SLICING OPERATION Read More »

ACCESSING NESTED TUPLE IN PYTHON

ACCESSING NESTED TUPLE IN PYTHON INTRODUCTION Nested tuple will contain complex data types like list, tuple, dictionary, sets etc. as a field. They can also contain data types like integer, string, floating, boolean etc. ORDER OF PYTHON TOUPLE Order in Python list is very important. Because tuple fields are accessed in the order they appear …

ACCESSING NESTED TUPLE IN PYTHON Read More »