#!/usr/bin/python3 # -*- coding: utf-8 -*- import threading import time def n_printer(num: int) -> None: for i in range(num): print(i, threading.current_thread().name) time.sleep(0.5) print("Before calling function:") print(threading.current_thread().name) threads = [] for init in range(5, 16, 5): my_thread = threading.Thread(target=n_printer, args=(init,), name="t" + str(init)) my_thread.start() threads.append(my_thread)