List Comprehension Review
From now on, I’m going to be using list comprehension when it is more convenient so I want to give a quick review if you are still confused how it works.
The set up of list comprehension is:
[A for B in C]
A is the function that you want to apply to whatever variable you are getting, B is the way you denote the variable you are using the function on, and C is the array you are pulling variables.
So if you had an array yourArray = [1,2,3,4] and wanted to double it you would write:
[x*2 for x in yourArray]
Source Code