import threading
import time
def function1():
for _ in range(5):
print("Function 1")
time.sleep(1)
def function2():
for _ in range(5):
print("Function 2")
time.sleep(1)
if __name__ == "__main__":
thread1 = threading.Thread(target=function1)
thread2 = threading.Thread(target=function2)
thread1.start()
thread2.start()
thread1.join()
thread2.join()
print("Both threads have finished.")