# File: appendTest.py # # Running time test for Python's append function for lists vs # using the + operator. # import time import random REPS = 200000 # REPS = 10 random.seed() aList = [ ] start = time.time() for i in range (0, REPS): newNumber = random.randint(0,REPS) # print("newNumber =", newNumber) # aList.append(newNumber) aList = aList + [ newNumber ] # print(aList) finish = time.time() print("Elapsed time =", finish - start, "seconds")