Sayantan's Blog On Python Programming

bappa.sayantan@gmail.com

PYTHON NUMBER KEY VALUE IN DICTIONARY

PYTHON NUMBER KEY VALUE IN DICTIONARY INTRODUCTION Key and value pair both can be number in python dictionaries. Accessing Values Using Keys PYTHON NUMBER KEY VALUE IN DICTIONARY : Output In the above example, we have accessed all the values against keys in dictionary dict_year_count. Using values() function PYTHON NUMBER KEY VALUE IN DICTIONARY : …

PYTHON NUMBER KEY VALUE IN DICTIONARY Read More »

INTRODUCTION TO PYTHON DICTIONARIES

INTRODUCTION TO PYTHON DICTIONARIES INTRODUCTION DICTIONARY DATA TYPE Dictionaries are enclosed with in curly brackets. Key and values are paired with semi colon. Each key value pair are separated with a comma. INTRODUCTION TO PYTHON DICTIONARIES : Output NUMERIC KEY VALUE PAIR INTEGER VALUE INTRODUCTION TO PYTHON DICTIONARIES : Output In the above example, key …

INTRODUCTION TO PYTHON DICTIONARIES Read More »

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 »