Hello, I'm a brand new beginner in Python, I'm taking the Udemy course and I got stuck at this question. Can you guys help me and please explain to me my mistake and the solutions? Please make the explanation as simple as possible because like I said, I'm brand new. Thank you so much
*
will pack and unpack the list. In your case, you combines them to a tuple. More info - What does asterisk * mean in Python?
You just need to loop through them.
def myFunc(*args):
return [i for i in args if i % 2 ==0]
print(myFunc(5,6,7,8))
Output:
[6,8]