(l)
| 13 | q.put(res) |
| 14 | |
| 15 | def multithreading(l): |
| 16 | q = Queue() |
| 17 | threads = [] |
| 18 | for i in range(4): |
| 19 | t = threading.Thread(target=job, args=(copy.copy(l), q), name='T%i' % i) |
| 20 | t.start() |
| 21 | threads.append(t) |
| 22 | [t.join() for t in threads] |
| 23 | total = 0 |
| 24 | for _ in range(4): |
| 25 | total += q.get() |
| 26 | print(total) |
| 27 | |
| 28 | def normal(l): |
| 29 | total = sum(l) |