I know that similar questions exist, but I'd like to know what is wrong with my code in particular. Thanks in advance!
isum = 0
l = list(range(2, uplim + 1))
while l != []:
isum += l[0]
temp = list(range(l[0], uplim + 1, l[0]))
l = list(set(l) - set(temp))
print(isum)
Explanation: the first loop execution will add 2 (being the first term in the list) to the sum variable and remove all multiples of 2 from the list. 3 will now be the first term in the list and this will be added to isum, followed by all multiples of 3 being removed. 5 will now be the first term (because 4 was removed - being a multiple of 2) etc.