Advertisement
Jexal

3843dd1e-5ed1-42f2-9cd3-53972b55098d

Jan 19th, 2025
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.26 KB | None | 0 0
  1. import time
  2.  
  3. def cpu_task(n):
  4.     total = 0
  5.     for i in range(n):
  6.         total += i**2
  7.     return total
  8.  
  9. start = time.time()
  10. results = [cpu_task(10_000_000) for _ in range(4)]
  11. end = time.time()
  12.  
  13. print(f"Execution Time: {end - start:.2f} seconds")
  14.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement