I am making a program that deletes every third element of a list starting at the element[2]. Towards the end of this for loop, the program stops prematurely.
import random
inputrange = int(input('How many numbers do you want in the list?'))
intmax = int(input('What is the largest possible integer in the list?'))
intmin = int(input('What is the smallest possible integer in the list'))
rand = [random.randint(intmin,intmax) for i in range(inputrange)]
for i in rand:
    del rand[2::3]
    print(rand[2::3])
    print(rand)
print(rand)
In a list starting with 100 elements (just an example), I end up with 7 elements in rand. Why? The program should continue del rand[2::3] until there are no more elements to allow for a deletion. With 7 elements remaining given the aforementioned 100 elements to begin, the loop should run 4 more times until only rand[0] and rand[1] exist. However I am left with rand[0, 6]
 
    