Tom_Jung

Untitled

Feb 4th, 2019
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. import random
  2. from timeit import timeit
  3.  
  4. ts = lambda: sorted(list_to_sort)
  5.  
  6. list_to_sort = [ ]
  7.  
  8. for x in range(0,1000):
  9. list_to_sort.append(random.randint(0,1000))
  10.  
  11. print("Data = ",list_to_sort)
  12.  
  13.  
  14. print("Timsort took: ")
  15. print(timeit(ts, number = 100))
Advertisement
Add Comment
Please, Sign In to add comment