Working with Threads in Python
For this activity, you will need to be using an Integrated Development Environment (IDE). The recommended IDE for this module is JetBrains IntelliJ IDEA for Python and JetBrains CLion for C++. You can follow instructions at the following page to set up your development environment:
Setting up your Development Environment
Task 1 - Display Odd and Even Numbers
For this task you will need to implement a method that will create two threads. The first thread will display odd
numbers up-to (and including) the limit of 100
. The second thread will be the same as the first thread, but will
display only the even numbers.
Task 2 - Threading Multiplication Tables
For this task you will create a script of n
threads, where n
is a value in the range of 1...12
. Each of the
threads will display the multiplication table for a given number in the range of n
. For example, thread one will
display the multiplication table for 1
and thread two will display the multiplication table for 2
.
Task 3 - Revisiting the Brute-Force Coursework
For this task, you will want to revisit the first assignment from 4061CEM and re-implement your Brute-Forcing algorithm to take advantage of multiprocessing. You may want to consider the logic on how you would go about threading the script and think about the following:
- Do you thread each string length?
- i.e.
thread1 -> gen_length_one(), thread2 -> gen_lenmgth_two()
- i.e.
- Do you thread the string building process for each string length?
- Example: A string of length four, would you have two threads: one that works on the first half of the
alphanumeric list and a second thread working the second half of the alphanumeric list?
- e.g.
thread1 -> [aaaa, aaab, aaac]
- e.g.
thread2 -> [zzzz, zzzy, zzzx]
- e.g.
- Example: A string of length four, would you have two threads: one that works on the first half of the
alphanumeric list and a second thread working the second half of the alphanumeric list?