title: How can I create a list out of the arguments given in a function?
body: <p>I am a beginner in Python3 and I am trying to figure out how I can solve this exercise:</p>
  
  <p>Define a function called <code>myfunc</code> that takes in an arbitrary number of arguments ans returns a list containing only those arguments that are even.</p>
  
  <p>I tried this:</p>
  
  <pre><code>def myfunc(*args):
      a= list(args)
      for num in a:
              if num%2==0:
                  return num
  </code></pre>
  
  <p>When trying to call out <code>myfunc(1,2,3,4,5,6)</code> it takes only the first even number:2.Why does this happen?</p>
  
  <blockquote>
    <p>How can I create a list that returns only the even numbers?</p>
  </blockquote>