# th

user_7840863
plain_text
2 months ago
2.4 kB
1
Indexable
Never
```import threading

def __init__(self,n):
super().__init__()
self.__n=n

def run(self):
if self.__n%2==0:
print(self.__n," is even")
else:
print(self.__n," is odd")

def main():
x=int(input("Enter the num1:"))
y=int(input("Enter the num2:"))
for i in range(x,y+1):
x=f(i)
x.start()

main()

**************************************************
#Q1

def __init__(self,i):
self.__i=i

def run(self):
for x in range (10):

print(self.__i)

def main():
D1= Draw('*')
D1.start()

D2= Draw('#')
D2.start()

main()

***********************************************************************

#Q2

def __init__(self,num):
self.__num=num

def run(self):
if self.__num>= 0:
if self.__num==0 or self.__num==1:
print("The factorial of",num,"is:1")
else:
fact=1
for i in range(1,self.__num+1):
fact*=i
print("The factorial of",self.__num,"is: ",fact)
def main():

for i in range(x,(y+1)):
f=fact(i)
f.start()

main()
*******************************************************************

def __init__(self,n):
self.__n=n

def run(self):
if(self.__n%2==0):
print(self.__n," is even number")
else:
print(self.__n," is odd number")

def main():
n1=int(input("please enter the first number "))
n2=int(input("please enter the second number "))
List=[]
for i in range(n1,n2+1):
obj=th(i)
List.append(obj)

for j in List:
j.start()

main()

```