Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • 1
    I sounds like you have code formatting problems: You should only ever have one Time taken:... printout. Commented Aug 8, 2017 at 15:18
  • 1
    Plus you should never poll q.empty() since a greedy thread might steal the last item and leave all the other threads waiting for items that will never appear. What you should use is an end of queue marker. One per thread. Commented Aug 8, 2017 at 15:21
  • Otherwise this is a good question. You have shown some effort in writing code and collecting output and shown what you were expecting to happen. Commented Aug 8, 2017 at 15:27
  • @quamrana you where right, polling q.empty() was the solution to 2 Commented Aug 8, 2017 at 16:50
  • 1
    You can be PEP8 compliant, but an extra or missing indentation can completely change a python program. Commented Aug 8, 2017 at 18:35