Advertisement
Guest User

Pas

a guest
Feb 15th, 2020
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. Python program to show time by perf_counter()
  2.  
  3. from time import perf_counter
  4.  
  5.  
  6. # integer input from user, 2 input in single line
  7.  
  8. n, m = map(int, input().split())
  9.  
  10.  
  11. # Start the stopwatch / counter
  12.  
  13. t1_start = perf_counter()
  14.  
  15.  
  16.  
  17. for i in range(n):
  18.  
  19. t = int(input()) # user gave input n times
  20.  
  21. if t % m == 0:
  22.  
  23. print(t)
  24.  
  25.  
  26. # Stop the stopwatch / counter
  27.  
  28. t1_stop = perf_counter()
  29.  
  30.  
  31.  
  32. print("Elapsed time:", t1_stop, t1_start)
  33.  
  34.  
  35.  
  36.  
  37.  
  38. print("Elapsed time during the whole program in seconds:",
  39.  
  40. t1_stop-t1_start)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement