I need help understanding list comprehensions in python.
per w3 the syntax for a list comprehension is:
newlist = [expression for item in iterable if condition == True]
after watching youtube videos I see people inputting what they want for the expression part of the syntax.
and than we use the for loop to feed the numbers into the expression.
So basically we create an expression or a formula that will apply the calculation for the for loop first, and than write the actual for loop. is this correct?
is there a simpler way to explain the syntax?