title: (Multi-Threading Python) Print 1 to 10 numbers alternatively, using two threads
body: <p>Please help me in resolving below Deadlock situation while printing 1 to 10 numbers alternatively, using two threads.</p>
  
  <p>And please tell me the best practices to avoid deadlock situation in multi-threading python.</p>
  
  <pre><code>from threading import *
  
  c = Condition()
  
  def thread_1():
      c.acquire()
      for i in range(1, 11, 2):
          print(i)
          c.notify()
          c.wait()
      c.release()
      c.notify()
  
  def thread_2():
      c.acquire()
      c.wait()
      for i in range(2, 11, 2):
          print(i)
          c.notify()
          c.wait()
      c.release()
  
  
  t1 = Thread(target=thread_1)
  t2 = Thread(target=thread_2)
  
  t1.start()
  t2.start()
  </code></pre>