Example & Tutorial understanding programming in easy ways.

Find all even number from the list using filter() function in Python ?

program:

l=[1,2,3,4,5,6]

def even(n):

     if n%2==0:

          return True

a=list(filter(even,l))

print(a)

output:

[2,4,6]

Read More →