Series of Number Raised to 2 using Threads || Python

 

In this we are going to see a program on how to calculate Series of Number Raised to 2 using Threads in Python Programming Language.


import threading as th
import time

def power(a,n):
    print(f"Power of 2 raised {n} is ",a**n)

a = 2
n = 1

for i in range(10):

    t1 = th.Thread(target=power,args=(a,n))
    n+=1
    time.sleep(1)
    t1.start()

# Coded by Saahil

#ENJOY CODING


Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post