How to do multithreading to add two random numbers for 10000 times in Python.

by: ratan.vba, 7 years ago


Hi Team I have made a class in Python:

class cal():
    def __init__(self,a,b):
        self.a=a
        self.b=b
    def add(self):
        return self.a+self.b

now I want to call this class atleast for 10000 times but not in single thrad. how can I do this. I am trying to put the idea which was taught here in a video of multithreading but I am not able to get it. Please help me in this. please



You must be logged in to post. Please login or register an account.



I'd personally look into multiprocessing rather than threads for this: https://pythonprogramming.net/multiprocessing-python-intermediate-python-tutorial/

-Harrison 7 years ago

You must be logged in to post. Please login or register an account.