Advertisement
pacho_the_python

Untitled

Jan 26th, 2022
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.54 KB | None | 0 0
  1. import random
  2. import time
  3.  
  4. random_list = []
  5.  
  6. for i in range(10, 21):
  7.     random_list.append(i)
  8.  
  9. counter = 0
  10.  
  11. while True:
  12.     counter += 1
  13.     random_sec = random.choice(random_list)
  14.     counter_sec = random_sec
  15.  
  16.     tic = time.perf_counter()
  17.  
  18.     while True:
  19.         toc = time.perf_counter()
  20.         if toc - tic > 1:
  21.             counter_sec -= 1
  22.             print(counter_sec)
  23.             tic = toc
  24.             if counter_sec <= 0:
  25.                 print("Bang!")
  26.                 break
  27.     if counter > 5:
  28.         break
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement