i wrote a python code to calculate square of the number using multiprocessing. it shows the error below. How to fix it.
import os
from multiprocessing import Process, current_process
def sqaure(number):
result=number*number
process_id=os.getpid()
print(f"Process ID : {process_id}")
print(f"the number {number} sqaures to {result}")
if __name__=='__main__':
numbers=[1,2,3,4]
processes=[]
for number in numbers:
process=Process(target=sqaure, args=(number,))
processes.append(process)
process.start()
error:
Traceback (most recent call last):
File "C:/Users/Rohan/PycharmProjects/untitled1/hyu.py", line 2, in <module>
from multiprocessing import Process, current_process
ImportError: cannot import name 'Process' from 'multiprocessing' (C:\Users\Rohan\PycharmProjects\untitled1\multiprocessing.py)