Python Lambda Function

The Lambda function in Python programming which is also known as anonymous function is a function without any name. It is a small function restricted to a single line. Like the normal function in Python, it can take multiple arguments but the function body should contain only one expression. Regular Python functions are declared using … Read more

Python filter() function

The filter function in Python filters the elements from a sequence or iterable with the use of a function that is passed as an argument to filter function. It tests each element that if it satisfies a certain condition or not. Like the Python map() function, the filter() function also takes two arguments. The first … Read more

Python map() function

The map() function in Python applies a function to each element of an iterable. This function takes two arguments first is function and the second is iterable and returns a map object. In this article, you will learn how to use the map() function in Python. The syntax of the Python map() function The syntax … Read more

Python Set Comprehension

A Python set is an unordered collection of unique items that is iterable, mutable, and has no duplicate items. You can perform mathematical set operations such as union, intersection, set difference, etc on Python sets. The set comprehension is similar to the Python list or dictionary comprehension it provides a shorter syntax to create sets … Read more

Python Dictionary Comprehension

Python dictionary data type is used to store data in key:value pairs. It can be created in two ways first is by placing the comma-separated items inside curly braces and the second is to create using dict() function. For example – users={1:’Ankit’, 2:’Sumit’, 3:’John’, 4:’Vinay’} Python dictionary comprehension provides a shorter syntax to create dictionaries. In … Read more