logancberrypie

Untitled

Dec 10th, 2015
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.53 KB | None | 0 0
  1. from threading import *
  2. from threading import Thread
  3.  
  4. def func1():
  5.     a = 500
  6.     b = 100
  7.     total2 = 0
  8.     while b > 0:
  9.         print("number : "+str(b)+ " \n")
  10.         total2 += a
  11.         b -= 1
  12.     func2.kill()
  13.     print(total)
  14.    
  15.  
  16. def func2():
  17.     global total
  18.     total = 0
  19.     a = 100
  20.     b = 500
  21.     while b > 0:
  22.         print("loop : "+str(b))
  23.         total += a
  24.         b -= 1
  25.     print(total)
  26.    
  27.  
  28. if __name__ == '__main__':
  29.    
  30.     Thread(target = func1).start()
  31.     Thread(target = func2).start()
Advertisement
Add Comment
Please, Sign In to add comment