Skip to content

Instantly share code, notes, and snippets.

@dtaivpp
Created December 11, 2019 15:56
Show Gist options
  • Save dtaivpp/665748249d6384f512df16f77de2abfc to your computer and use it in GitHub Desktop.
Save dtaivpp/665748249d6384f512df16f77de2abfc to your computer and use it in GitHub Desktop.
import random
from time import time
random.seed(time())
#### List Access Tests ####
times = {'colsAndRows': 0, 'rowsAndCols': 0}
def generateArray(size):
return [[0]*size]*size
for i in range(0,50):
print(f"Pass: {i}")
size = random.randint(1_000, 10_000)
array = generateArray(size)
startTime = time()
rowsAndCols = [array[x][y] for x in range(0, size) for y in range(0, size)]
endTime = time()
times.update({'rowsAndCols': endTime - startTime})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment