I created a list, a set and a dict and now I want to remove certain items from them
N = [10**i for i in range(0,3)] #range(3,7) for 1000 to 1M
for i in N:
con_list = []
con_set = set()
con_dict = {}
for x in range (i): #this is the list
con_list.append(x)
print(con_list)
for x in range(i): #this is the set
con_set.add(x)
print(con_set)
for x in range(i): #this is the dict
con_dict = dict(zip(range(x), range(x)))
print(con_dict)
items to remove
n = min(10000, int(0.1 * len(con_list)))
indeces_to_delete = sorted(random.sample(range(i),n), reverse=True)
now if I add this:
for a in indeces_to_delete:
del con_list[a]
print(con_list)
it doesn't work
Need to do the same for a set and a dict
Thanks!