Menu Close
    Hire us Request quote Reading list Switch to dark mode

    Advanced Python Features(Lambda, Map, Filter)

    Python is a simple, easy to use yet powerful language. Python includes an infinite number of built-in functions. Here we will discuss some of the beautiful things of the python.

    Lambda: Lambda is an anonymous function. Anonymous functions in python mean that these functions don’t have a name and we write them as one-liners. Normal functions in python start with a def keyword and have a function name. In other words, anonymous does not start with def and does not have any function name. Lambda is one such type of function. Lambda function has one expression and can take any type of argument.

    Syntax:
    lambda arguments: expression


    Example:

    Map: Map is a Python built-in function that is used to iterate an iterable through a specified function. It executes the function through each item in the iterable. It is used to apply a function to a sequence of elements like a list or dictionary.

    Syntax:
    map(fun, iterable)

    Example:


    Filter: Filter is similar to the map but it only returns those values for which the applied function returns True. The function returns an iterator where the items are filtered through a function to test if the item is accepted or not.

    Syntax:
    filter(function, iterable)


    Example

    . . .

    Comment

    Add Your Comment

    Be the first to comment.

    Back to Top
    css.php
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just received your message and our expert will get back to you shortly.
    Send Again
    Close