How to measure the time of creating a list with for loop in Python

1 Answer

0 votes
from time import process_time

start = process_time()

lst = [i for i in range(100000)]

end = process_time()

print(end - start)


 
 
 
 
'''
run:

0.009295050000000003

'''


 



answered Mar 3, 2023 by avibootz

Related questions

1 answer 207 views
1 answer 229 views
229 views asked Jun 26, 2018 by avibootz
1 answer 217 views
1 answer 165 views
165 views asked May 29, 2023 by avibootz
1 answer 133 views
...