fork download
  1. # Online Python compiler (interpreter) to run Python online.
  2. # Write Python 3 code in this online editor and run it.
  3. print("Try programiz.pro")
  4.  
  5. import multiprocessing
  6.  
  7. res = []
  8.  
  9. def calculation(numbers):
  10. print("here")
  11. global res
  12. for n in numbers:
  13. res.append(n*n)
  14. print("inside the process"+str(res))
  15.  
  16.  
  17. if __name__ == "___main__":
  18. nums = [1,2,3]
  19. print("dsafa")
  20. p1 = mutltiprocessing.Process(target=calcultation, args=(nums,))
  21. p1.start()
  22. p1.join()
  23.  
  24. print("outside"+str(res))
Success #stdin #stdout 0.02s 8192KB
stdin
Standard input is empty
stdout
Try programiz.pro