title: Syntax error while using Lambda functions
body: <p>I have a list with some dummy email address as below:</p>
  
  <pre><code>listEmails = ['brian-23@email.com', 'britts_54@email.com', 'lara$@email.com']
  </code></pre>
  
  <p>I was trying to use <code>lambda</code> and <code>filter</code> to get the list of valid email address.
  let's assume <code>lara$@email.com</code> is the only invalid email address.</p>
  
  <p>I used the regular expression to filter out the invalid emails using the below code.</p>
  
  <pre><code>listValid = list(filter(lambda x: x if re.match(r"^[A-Za-z0-9\.\+_-]+@[A-Za-z0-9\._-]+\.[a-zA-Z]{0,3}$",x) ,listEmails))
  </code></pre>
  
  <p>I have been receiving a syntax error at <code>,</code> before <code>listEmails))</code>.</p>
  
  <p>Generally, the <code>lambda</code> function takes the value after the comma(<code>,</code>) as the <strong>input value</strong>, so I am not sure if the <code>lambda</code> function is assuming <code>x</code> from <code>re.match(r"^[A-Za-z0-9\.\+_-]+@[A-Za-z0-9\._-]+\.[a-zA-Z]{0,3}$",x)</code> as the input value.</p>
  
  <p>Lambda function with <code>if</code> conditions are possible from the below case:</p>
  
  <pre><code>from functools import reduce
  f = lambda a,b: a if (a &gt; b) else b
  reduce(f, [47,11,42,102,13])
  </code></pre>
  
  <p>So, I wanted to know why it isn't working in my case?</p>
  
  <p>Note: Since I got an error at the <code>lambda</code> function itself, I haven't evaluated if the <code>list(filter(</code> would return the desired result.</p>