Q. Write equivalent list comprehension for the following code:


target1 = []

for number in source:

    if number & 1:

        target1.append(number)


Answer =

target1 = [number for number in source if number & 1 ]

Post a Comment

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

Previous Post Next Post