Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from threading import *
- from threading import Thread
- def func1():
- a = 500
- b = 100
- total2 = 0
- while b > 0:
- print("number : "+str(b)+ " \n")
- total2 += a
- b -= 1
- func2.kill()
- print(total)
- def func2():
- global total
- total = 0
- a = 100
- b = 500
- while b > 0:
- print("loop : "+str(b))
- total += a
- b -= 1
- print(total)
- if __name__ == '__main__':
- Thread(target = func1).start()
- Thread(target = func2).start()
Advertisement
Add Comment
Please, Sign In to add comment