I'm relatively new to Python and have been told to create a list using list comprehension to only display even numbers between 0-100 then add all of those numbers together. I understand how to do it if it was just a regular list such as:
Total = 0
for x in range (0,101,2):
Total += x
I have no idea what to do though with the comprehension. It makes no sense to me. This is what I have.
Total = 0
x = [x for x in range (1001) if x % 2 ==0]
Total +=int(???)
print('The total is:', Total)
I don't know what to put in for the ??? or even if I'm going about this the right way. Any help would be great!
Edit: I forgot to mention it needs to be in a for loop. I don't know how to create the for loop and the comprehension list.