How to declare array of zeros in python (or an array of a certain size)

buckets = [0] * 100

Careful – this technique doesn’t generalize to multidimensional arrays or lists of lists. Which leads to the List of lists changes reflected across sublists unexpectedly problem

Leave a Comment