In the following list
[11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
I would like to remove the bottom half of the list, 11-15 However when I try the code below, even though the index seems correct I'm left with wrong parts of my original list
x = list(range(11,21))
print(x) #[11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
i = list(range(0,(int(len(x)/2)))) #[0, 1, 2, 3, 4]
for n in i:
print(x[n]) #Correctly prints 11-15
for n in i:
del x[n]
print(x) #[12, 14, 16, 18, 20]
How do I modify this so that I remove the first half of a list regardless of size based on index?