Vikram Chiluka has Published 288 Articles

Python Program to Alternate list elements as key-value pairs

Vikram Chiluka

Vikram Chiluka

Updated on 27-Jan-2023 11:31:42

406 Views

In this article, we will learn how to get alternate list elements as key-value pairs in python. Assume we have taken an input list containing integers. We will now Methods Used The following are the various methods used to accomplish this task − Using for loop Using dictionary comprehension ... Read More

How to Common keys in list and dictionary using Python

Vikram Chiluka

Vikram Chiluka

Updated on 27-Jan-2023 11:30:17

645 Views

In this article, we will learn how to find common keys in a list and dictionary in python. Methods Used The following are the various methods to accomplish this task − Using the ‘in’ operator and List Comprehension Using set(), intersection() functions Using keys() function & in operator Using ... Read More

Find the difference of the sum of list elements that are missing from Matrix and vice versa in python

Vikram Chiluka

Vikram Chiluka

Updated on 27-Jan-2023 11:26:23

120 Views

In this article, we will learn how to find the difference of the sum of list elements that are missing from Matrix and vice versa. Methods Used The following are the various methods to accomplish this task − Using for loop & from_iterable() function Using sum() & from_iterable() functions ... Read More

Case-insensitive string replacement using Python Program

Vikram Chiluka

Vikram Chiluka

Updated on 27-Jan-2023 11:20:58

4K+ Views

In this article, we will learn Case insensitive string replacement in python. Methods Used The following are the various methods to accomplish this task − Using re.IGNORECASE, re.escape(), re.sub() Using re.sub(), lambda, re.escape() functions Using split(), lower() & replace() functions Using split(), list() and join() functions ... Read More

How to capture SIGINT in Python?

Vikram Chiluka

Vikram Chiluka

Updated on 24-Jan-2023 20:10:44

799 Views

In this article, we will learn how to capture SIGINT in Python and what has to be done after capturing it. When the signal module receives signals, it does a certain action. Besides that, it can capture the user's interruption through the keyboard using SIGINT. Modules Needed Signal Module The ... Read More

How to generate IP addresses from a CIDR address using Python?

Vikram Chiluka

Vikram Chiluka

Updated on 24-Jan-2023 19:18:42

3K+ Views

In this article, we will learn how to generate IP addresses from the CIDR address. Methods Used The following are the various methods to accomplish this task − Generating IPv4 Network addresses Generating IPv6 Network addresses Accessing IP addresses of the CIDR address Method 1: IPv4Network Algorithm (Steps) ... Read More

How to find Profit or loss using Python when CP of N items is equal to SP of M

Vikram Chiluka

Vikram Chiluka

Updated on 24-Jan-2023 19:13:18

382 Views

In this article, we will learn a python program to find the profit or loss when the cost price CP of N items is equal to the selling price SP of M items. Assume we have taken N, and M values which represent the cost price of N items are ... Read More

How to Determine Last Friday’s Date using Python?

Vikram Chiluka

Vikram Chiluka

Updated on 24-Jan-2023 19:12:10

2K+ Views

In this article, we will learn how to determine last Friday’s Date using Python. Methods Used The following are the various methods to accomplish this task − Using datetime module Using dateutil package Method 1: Using Datetime Module Algorithm (Steps) Following are the Algorithm/steps to be followed to ... Read More

How to detect whether a Python variable is a function?

Vikram Chiluka

Vikram Chiluka

Updated on 24-Jan-2023 19:10:46

5K+ Views

In this article, we will learn how to detect whether a Python variable is a function. Sometimes, it is essential to figure out whether or not a Python variable is a function. When the code is a thousand lines long and you are not the creator of the code, this ... Read More

How to create a dictionary of sets in Python?

Vikram Chiluka

Vikram Chiluka

Updated on 24-Jan-2023 19:08:33

2K+ Views

In this article, we will learn how to create a dictionary of sets in Python. Methods Used The following are the various methods used to accomplish this task − Using the Naive Method Using defaultdict() Method Using setdefault() Method Method 1: Using the Naive Method In this method, ... Read More

Advertisements