August 2021
Beginner to intermediate
118 pages
1h 29m
English
| Puzzle 24 | 12 Angry Men |
| | from concurrent.futures import ProcessPoolExecutor |
| | from itertools import repeat |
| | |
| | guilty = 0 |
| | |
| | |
| | def juror(): |
| | global guilty |
| | |
| | guilty += 1 |
| | |
| | |
| | with ProcessPoolExecutor() as pool: |
| | for _ in repeat(None, 12): |
| | pool.submit(juror) |
| | |
| | print(guilty) |
Guess the Output | |
|---|---|
|
|
Try to guess what the output is before moving to the next page. |
This code will print: 0
Both threads and processes are concurrent ...
Read now
Unlock full access