Q. Predict the output:


def even(n):

    return n % 2 == 0

list1 = [1,2,3,4,5,6,7,8,9]

ev = [n for n in list1 if n % 2== 0]

evp = [n for n in list1 if even(n) ]

print(evp)


Answer =

Output:-

[2, 4, 6, 8]
>>>

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post