468,790 Members | 1,892 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,790 developers. It's quick & easy.

Python Threads

Hi everyone, i am stuck with Threads in python.
Can someone help me?

Expand|Select|Wrap|Line Numbers
  1. def Kub(x):
  2.     a=x*x*x
  3.     return a
  4.  
  5. print("Unesite broj veci od 10 i manji od 150000")
  6. i=0
  7. x=int(input())
  8. while i!=x:
  9.     if x>10 and x<150000:
  10.         i=x
  11.         print(i)
  12.     else:
  13.         print("Unesite drug broj u dadeni interval")
  14.         x=int(input())
  15. y=i/3
  16. z=y+y
  17. start = time.perf_counter()
  18. t1 = threading.Thread(target=Kub, args=(0, y))
  19. t2 = threading.Thread(target=Kub, args=(y, z))
  20. t3 = threading.Thread(target=Kub, args=(z, i))
Jun 12 '21 #1
1 2484
Banfa
9,058 Expert Mod 8TB
You haven't said what the problem you are having is, you have just posted code. You need to explain what you were expecting to happen and also what actually happened.

However you do not start any of the treads you create e.g.

Expand|Select|Wrap|Line Numbers
  1. ti.start()
Jun 14 '21 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

By using this site, you agree to our Privacy Policy and Terms of Use.