testList= []
testList[12]= 31
testList[23]= 1337
Error: IndexError: list assignment index out of range
Basically I have unique Integers and I want to use the lists for a hash function h(x)= x (because they are unique)
I could initialize the length like this:
testList= [0 for i in range(50)]
But then I have to fix the size and my unique numbers which I have increase with time. Is it ok to set the size to for example 1-2Mio or is there a way to do this dynamically? ArrayList<> in Java is dynamically for append and delete but so are Lists in Python also.
Thanks!
dict:testDict={}instead.