

{"id":8851,"date":"2018-02-21T10:59:19","date_gmt":"2018-02-21T05:29:19","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=8851"},"modified":"2026-04-23T15:50:36","modified_gmt":"2026-04-23T10:20:36","slug":"python-lambda-expression","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/python-lambda-expression\/","title":{"rendered":"Python Lambda Expression &#8211; Declaring Lambda Expression &amp; Its Defaults"},"content":{"rendered":"<p>In this Python Tutorial, we will study What is Python Lambda Expression with its syntax and examples.<\/p>\n<p>Moreover, we will study how to and when to declare a Lambda Expression in Python, Python Lambda with inbuilt Python lambda functions, and some Python functions are: reduce(), map(), and filter().<\/p>\n<p>When creating\u00a0functions in Python, we use the def keyword. We bind them to a name while doing so.<\/p>\n<p>But sometimes, we may want to declare a function anonymously. Or we may want to use a function only once. In such a case, defining a function seems a bit extra.<\/p>\n<p>So, let&#8217;s start learning Lambda Expression in Python.<\/p>\n<div id=\"attachment_8888\" style=\"width: 1210px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Lambda-Expressions-in-Python-2.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-8888\" class=\"wp-image-8888 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Lambda-Expressions-in-Python-2.jpg\" alt=\"Python Lambda Expression \" width=\"1200\" height=\"628\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Lambda-Expressions-in-Python-2.jpg 1200w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Lambda-Expressions-in-Python-2-150x79.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Lambda-Expressions-in-Python-2-300x157.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Lambda-Expressions-in-Python-2-768x402.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Lambda-Expressions-in-Python-2-1024x536.jpg 1024w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/a><p id=\"caption-attachment-8888\" class=\"wp-caption-text\">Python Lambda Expression<\/p><\/div>\n<h3><span id=\"2_An_Introduction_to_Lambdas\">What is a Python Lambda Expression?<\/span><\/h3>\n<p>Python lambda expression\u00a0allows us to define a function anonymously. It is worthwhile to note that it is an expression, not a statement.<\/p>\n<p>That is, it returns a value; it has an implicit return statement. The following is the\u00a0Python syntax\u00a0of a lambda expression in Python.<\/p>\n<p>lambda [arg1,arg2,..]:[expression]<\/p>\n<p>Where you place a lambda expression in Python, it returns the value of the expression.<\/p>\n<p><strong>Advantages of lambda expression in Python:<\/strong><\/p>\n<ul>\n<li><strong>Short code:<\/strong> It lets you write the function in one line, avoiding unnecessary code.<\/li>\n<li><strong>No proper definition:<\/strong> you don\u2019t have to use the define function for simple operations.<\/li>\n<li><strong>Useful for quick operations:<\/strong> It can be useful when you need a function temporarily.<\/li>\n<li><strong>Readable:<\/strong> It helps in making the code simple and easy to understand.<\/li>\n<\/ul>\n<h3><span id=\"3_Declaring_Lambda_expressions_in_python\">How to Declare a Python Lambda Expression?<\/span><\/h3>\n<p>To declare a lambda expression in Python, you use the lambda keyword.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; lambda e:e-2<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>&lt;function &lt;lambda&gt; at 0x03DBA978&gt;<\/p>\n<\/div>\n<p>You can assign it to a variable if you want to be able to call it again later.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; downbytwo=lambda e:e-2<\/pre>\n<p>Here, e is the argument, and e-2 is the expression. Then you would call it like you would call any other Python Lambda function.<\/p>\n<p>Here, we passed the integer 1 as an argument.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; downbytwo(1)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">-1<\/div>\n<p>You can also pass an argument along with the declaration. Use parentheses for this.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; (lambda e:e-2)(1)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>-1<\/p>\n<\/div>\n<h3><span id=\"4_What_Exactly_is_an_Expression\">What Exactly is an Expression in Python?<\/span><\/h3>\n<p>As we\u2019ve seen, the expression is what the Python3 lambda returns, so we must be curious about what qualifies as an expression.<\/p>\n<p>An expression here is what you would put in the return statement of a Python Lambda function. The following items qualify as expressions.<\/p>\n<p><strong>1. Arithmetic operations <\/strong>like a+b and a**b<\/p>\n<p><strong>2. Function calls <\/strong>like sum(a,b)<\/p>\n<p><strong>3. A print statement<\/strong>\u00a0like print(\u201cHello\u201d)<\/p>\n<p>Other things, like an assignment statement, cannot be provided as an expression to a Python lambda because it does not return anything, not even None.<\/p>\n<h3><span id=\"5_When_to_Use_Which\">When to Use Which Lambda Expression in Python?<br \/>\n<\/span><\/h3>\n<p>Like we\u2019ve seen so far, Python lambda expressions may take arguments and take one expression. The value of this expression is what it returns after evaluating.<\/p>\n<p>Python Lambda expression isn\u2019t necessary, but it\u2019s handy in certain situations. These are:<\/p>\n<h4><strong>1. When you have only a single statement to execute in your Python Lambda function<\/strong><\/h4>\n<p>Suppose we want to print a Hello in the body of a function printhello(). In this function\u2019s body, we have only one line of code.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; def printhello():\r\n       print(\"Hello\")\r\n&gt;&gt;&gt; printhello()<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">Hello<\/div>\n<p>Now, let\u2019s do this with a Python lambda expression.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; (lambda :print(\"Hello\"))()<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">Hello<\/div>\n<p>Notice that we did not provide any arguments here. We\u2019ll discuss this in a later section in this article. Let\u2019s take another example yet.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; z=lambda a=2:print(\"Hello\")\r\n&gt;&gt;&gt; z()<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>Hello<\/p>\n<\/div>\n<h4><strong>2. When you need to call that code only once<\/strong><\/h4>\n<p>One of the main reasons why we use functions, apart from modularity, is the reusability of code.<\/p>\n<p>But when you want to need some code only once, or less often, you may use a Python lambda expression in place of defining a function for it.<\/p>\n<h3><span id=\"6_Defaults_in_a_Lambda\">Defaults in Python Lambda Expression<\/span><\/h3>\n<p>In Python, and in other languages like C++, we can specify default arguments.<\/p>\n<p>But what is that? Suppose a function func1() has an arity of 2 with parameters a and b.<\/p>\n<p>What happens if the user provides only one argument or none? This is why you may want to provide default values for your parameters.<\/p>\n<p>Let\u2019s take an example.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; def func1(a=2,b=3):\r\n        print(a,' ',b)\r\n&gt;&gt;&gt; func1()<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>2 \u00a0\u00a03<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; func1(3)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">3\u00a0\u00a0 3<\/div>\n<p>Here, the default values for a and b are 2 and 3, respectively.<br \/>\nTo call as y(), need default arguments:<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; o=lambda x=1,y=2,z=3:x+y+z\r\n&gt;&gt;&gt; o(2,3)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>8<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; o(2)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>7<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; o<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>&lt;function &lt;lambda&gt; at 0x00A46150&gt;<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; o()<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>6<\/p>\n<\/div>\n<h3>Python Lambda Expression <span id=\"7_A_Deeper_Look_Into_The_Syntax_of_a_Lambda\">Syntax<\/span><\/h3>\n<p>We\u2019ve seen how we declare a lambda expression in Python, but where there are building blocks, there are possibilities. So, let\u2019s see what we can or can\u2019t do with a lambda.<\/p>\n<h4><span id=\"a_Arguments\">1. Python Arguments<\/span><\/h4>\n<p>One or more variables appearing in the expression may be declared previously. But if it\u2019s there in the arguments, either it should have a default value or must be passed as an argument to the call.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; a,b=1,2\r\n&gt;&gt;&gt; y=lambda a,b:a+b\r\n&gt;&gt;&gt; y()<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>Traceback (most recent call last):File &#8220;&lt;pyshell#167&gt;&#8221;, line 1, in &lt;module&gt;<\/p>\n<p>y()<\/p>\n<p>TypeError: &lt;lambda&gt;() missing 2 required positional arguments: \u2018a\u2019 and \u2018b\u2019<\/p>\n<\/div>\n<p>Here, both a and b are missing values.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; y=lambda a:a+b\r\n&gt;&gt;&gt; y()<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>Traceback (most recent call last):File &#8220;&lt;pyshell#169&gt;&#8221;, line 1, in &lt;module&gt;<\/p>\n<p>y()<\/p>\n<p>TypeError: &lt;lambda&gt;() missing 1 required positional argument: \u2018a\u2019<\/p>\n<\/div>\n<p>The variable a is still missing a value.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; y=lambda :a+b\r\n&gt;&gt;&gt; y()<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">3<\/div>\n<p>Finally, since no argument here is missing a value, it works just fine.<\/p>\n<h4><span id=\"b_Omitting_Arguments\">2. Omitting Arguments<\/span><\/h4>\n<p>It isn\u2019t mandatory to provide arguments to a lambda expression in Python, it works fine without them.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; y=lambda :2+3\r\n&gt;&gt;&gt; y()<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">5<\/div>\n<p>Another example would be where the expression is a print statement.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; (lambda :print(\"Hi\"))()<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">Hi<\/div>\n<p>Hence, we conclude that omitting arguments is acceptable.<\/p>\n<h4><span id=\"c_Omitting_the_Expression\">3. Omitting the Expression<\/span><\/h4>\n<p>Now let\u2019s try if it works without an expression.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; y=lambda a,b:<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">SyntaxError: invalid syntax<\/div>\n<p>Clearly, it didn\u2019t work. And why would it? The expression\u2019s value is what it returns, so without an expression, it would be a waste of time.<\/p>\n<h3><span id=\"8_Lambdas_with_In-Built_Functions\">Python Lambdas with In-Built Functions<\/span><\/h3>\n<p>There are some built-in functions, like filter() and map(), on which we can apply a Python lambda expression to filter out elements from a list.<\/p>\n<p>Let\u2019s see how. First, we take a list called numbers.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; numbers=[0,1,2,3,4,5,6,7,8,9,10]<\/pre>\n<p>Next, we take a lambda function as follows.<br \/>\nlambda x:x%3==0<\/p>\n<h4><span id=\"a_filter\">1. filter() in python<\/span><\/h4>\n<p>The filter() function takes two parameters- a function, and a list to operate on. Finally, we apply the list() function on this to return a list.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; list(filter(lambda x:x%3==0,numbers))<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[0, 3, 6, 9]<\/div>\n<p>This is the final code for our purpose, and guess what it does.<\/p>\n<p>Well, this code takes the list \u2018numbers\u2019, and filters out all elements from it except those which do not successfully divide by 3.<\/p>\n<p>Note that this does not alter the original list.<\/p>\n<h4><span id=\"b_map\">2. map() in python<\/span><\/h4>\n<p>The map() function, unlike the filter() function, returns values of the expression for each element in the list. Let\u2019s take the same list \u2018numbers\u2019.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; list(map(lambda x:x%3==0,numbers))<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[True, False, False, True, False, False, True, False, False, True, False]<\/div>\n<h4><span id=\"c_reduce\">3. reduce() in python<\/span><\/h4>\n<p>Lastly, the reduce() function takes two parameters- a function, and a list.<\/p>\n<p>It performs computation on sequential pairs in the list and returns one output. But to use it, you must import it from the functools module.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; from functools import reduce\r\n&gt;&gt;&gt; reduce(lambda x,y:y-x,numbers)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">5<\/div>\n<p>Let\u2019s perform a dry run.<br \/>\n1-0=1<br \/>\n2-1=1<br \/>\n3-1=2<br \/>\n4-2=2<br \/>\n5-2=3<br \/>\n6-3=3<br \/>\n7-3=4<br \/>\n8-4=4<br \/>\n9-4=5<br \/>\n10-5=5<br \/>\nHence, it outputs 5.<\/p>\n<p>Let\u2019s take another example.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; reduce(lambda x,y:y+x,numbers)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">55<\/div>\n<p>Try doing the same thing here for y+x instead; you should get 55.<\/p>\n<p>So, this was all about Python lambda expression. Hope you like our expression.<\/p>\n<h3>Python Interview Questions on Lambda Expression<\/h3>\n<ol>\n<li>What is a Lambda Expression in Python?<\/li>\n<li>How to write a Lambda Expression in Python?<\/li>\n<li>What is the advantage of a Lambda Expression in Python?<\/li>\n<li>Explain the Lambda keyword in Python?<\/li>\n<li>What is the syntax of a Lambda function in Python?<\/li>\n<\/ol>\n<h3><span id=\"9_Conclusion\">Conclusion<\/span><\/h3>\n<p>That\u2019s all for today. We learned quite a bit about Python3 lambda expression with syntax, how to create Lambda expressions in Python.<\/p>\n<p>Then we saw what qualifies as an expression, and also learned how to provide default arguments in Python Lambda expressions.<\/p>\n<p>Finally, we tried out three functions, filter(), map(), and reduce(), to make use of lambdas. A lambda, as compared to a normal function, offers its own benefits.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this Python Tutorial, we will study What is Python Lambda Expression with its syntax and examples. Moreover, we will study how to and when to declare a Lambda Expression in Python, Python Lambda&#46;&#46;&#46;<\/p>\n","protected":false},"author":5,"featured_media":8858,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[46],"tags":[3718,8066,8068,10632,16507,14089],"class_list":["post-8851","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","tag-defaults-in-python-lambda","tag-lambda-expression","tag-lambda-expressions-in-python","tag-python-lambda-expression","tag-python-lambda-in-built-functions","tag-syntax-of-python-lambda-expression"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Python Lambda Expression - Declaring Lambda Expression &amp; Its Defaults - DataFlair<\/title>\n<meta name=\"description\" content=\"Python Lambda Expression-Declaring Lambda Expressions in Python,In-built function &amp; Syntax of Lambda Expression Python, Defaults in Python Lambda expression\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/python-lambda-expression\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python Lambda Expression - Declaring Lambda Expression &amp; Its Defaults - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Python Lambda Expression-Declaring Lambda Expressions in Python,In-built function &amp; Syntax of Lambda Expression Python, Defaults in Python Lambda expression\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/python-lambda-expression\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-02-21T05:29:19+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-04-23T10:20:36+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Lambda-Expressions-in-Python-1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python Lambda Expression - Declaring Lambda Expression &amp; Its Defaults - DataFlair","description":"Python Lambda Expression-Declaring Lambda Expressions in Python,In-built function & Syntax of Lambda Expression Python, Defaults in Python Lambda expression","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/python-lambda-expression\/","og_locale":"en_US","og_type":"article","og_title":"Python Lambda Expression - Declaring Lambda Expression &amp; Its Defaults - DataFlair","og_description":"Python Lambda Expression-Declaring Lambda Expressions in Python,In-built function & Syntax of Lambda Expression Python, Defaults in Python Lambda expression","og_url":"https:\/\/data-flair.training\/blogs\/python-lambda-expression\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2018-02-21T05:29:19+00:00","article_modified_time":"2026-04-23T10:20:36+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Lambda-Expressions-in-Python-1.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/python-lambda-expression\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/python-lambda-expression\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823"},"headline":"Python Lambda Expression &#8211; Declaring Lambda Expression &amp; Its Defaults","datePublished":"2018-02-21T05:29:19+00:00","dateModified":"2026-04-23T10:20:36+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/python-lambda-expression\/"},"wordCount":1360,"commentCount":8,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/python-lambda-expression\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Lambda-Expressions-in-Python-1.jpg","keywords":["Defaults in Python Lambda","Lambda expression","Lambda Expressions in Python","python lambda expression","Python Lambda in-built Functions","Syntax of Python Lambda expression"],"articleSection":["Python Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/python-lambda-expression\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/python-lambda-expression\/","url":"https:\/\/data-flair.training\/blogs\/python-lambda-expression\/","name":"Python Lambda Expression - Declaring Lambda Expression &amp; Its Defaults - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/python-lambda-expression\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/python-lambda-expression\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Lambda-Expressions-in-Python-1.jpg","datePublished":"2018-02-21T05:29:19+00:00","dateModified":"2026-04-23T10:20:36+00:00","description":"Python Lambda Expression-Declaring Lambda Expressions in Python,In-built function & Syntax of Lambda Expression Python, Defaults in Python Lambda expression","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/python-lambda-expression\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/python-lambda-expression\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/python-lambda-expression\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Lambda-Expressions-in-Python-1.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Lambda-Expressions-in-Python-1.jpg","width":1200,"height":628,"caption":"Python Lambda Expression"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/python-lambda-expression\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Python Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/python\/"},{"@type":"ListItem","position":3,"name":"Python Lambda Expression &#8211; Declaring Lambda Expression &amp; Its Defaults"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team creates expert-level guides on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our goal is to empower learners with easy-to-understand content. Explore our resources for career growth and practical learning.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam1\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/8851","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=8851"}],"version-history":[{"count":15,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/8851\/revisions"}],"predecessor-version":[{"id":147817,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/8851\/revisions\/147817"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/8858"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=8851"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=8851"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=8851"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}