title: How to create multiple threads dynamically in Python
body: <p>I am creating a python code that have a function which should be run for number of times user asks using threads. Eg:</p>
  
  <pre><code>import time
  T = input("Enter the number of times the function should be executed")
  L = [1,2,3,4]
  
  def sum(Num):
      for n in Num:
          time.sleep(0.2)
          print("square:",n*n)
  </code></pre>
  
  <p>Based on the value of T from user, I want tho create T’ number of threads dynamically and execute the sum function in separate threads.</p>
  
  <p>If user gives input as 4 then I need to create 4 threads dynamically and execute the same function with 4 different threads.
  Please help me out to create 4 multiple threads.Thanks!</p>