Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import timeit
- import random
- test_list = [1, "test", 100.00] * 100000
- def get_first():
- return test_list[random.randint(1, 100)]
- def get_last():
- return test_list[random.randint(250000, 299999)]
- start = timeit.default_timer()
- for x in range(1000000):
- get_first()
- print(timeit.default_timer() - start)
- start = timeit.default_timer()
- for x in range(1000000):
- get_last()
- print(timeit.default_timer() - start)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement