Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- import time
- def create_list_in_range(min_value, max_value):
- random_list = [x for x in range(min_value, max_value)]
- return random_list
- def get_random_element_from_list(some_list):
- result = random.choice(some_list)
- return result
- def count_down_hello(min_num, max_num, number_of_iterations):
- counter = 0
- while True:
- counter += 1
- generated_list = create_list_in_range(min_num, max_num)
- counter_sec = get_random_element_from_list(generated_list)
- tic = time.perf_counter()
- while True:
- toc = time.perf_counter()
- if toc - tic > 1:
- counter_sec -= 1
- print(counter_sec)
- tic = toc
- if counter_sec == 0:
- print("Hello!")
- break
- if counter == number_of_iterations:
- break
- count_down_hello(5, 20, 5)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement