Advertisement
here2share

# sets_vs_lists_timed.py

Feb 24th, 2024
764
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.21 KB | None | 0 0
  1. # sets_vs_lists_timed.py
  2.  
  3. from timeit import timeit
  4.  
  5. def test():
  6.     print(
  7.         timeit(
  8.             "499 in n", globals={"n": numbers}
  9.         )
  10.     )
  11.  
  12. numbers = set([*range(500)])
  13. test()
  14.  
  15. numbers = [*range(500)]
  16. test()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement