I start with a list
L = [1,2,3,4,5,6,7,8,9,10]
I'm collecting all even numbers like this
new = []
for n in L:
if n % 2 == 0:
new.append(n)
I am not sure how I would specify the condition in the following statement
new = [n for n in L]
|
I start with a list
I'm collecting all even numbers like this
I am not sure how I would specify the condition in the following statement
|
|||||||
|
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, see the FAQ.
|
You can do |
|||||||||||
|