Write a python function to create two threads and start and join the two threads


Topic: Write a python function to create two threads and start and join the two threads

Solution

import threading 
  
def print_cube(num): 
    print("Cube: {}".format(num * num * num)) 
    
t1 = threading.Thread(target=print_cube, args=(10,)) 
t2 = threading.Thread(target=print_cube, args=(10,)) 
t1.start() 
t2.start() 
t1.join()
t2.join()



List all Python Programs