Comprehension scaled lists

Hello, I have a question about assigning a variable in lists. Take the set of code:

grades = [90, 88, 62, 76, 74, 89, 48, 57]
scaled_grades = [num + 10 for num in grades]
print(scaled_grades)

In the second line, I created the variable num, but my question is, how exactly does the code know to assign num to the numbers inside grades? Obviously, it doesn’t have to be num, I can make it anything. I could say [cat + 10 for cat in grades] and I would get the same answer with a different variable. I hope this makes sense. Any insight would be great! Thanks

The Python interpreter is set up so that it knows to look for a variable there and to use it as a pointer to each element in the list. The Python team hid that magic under the hood in order to make list comprehensions easier and faster to write. It does obscure the logic a little bit, though.