Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I'm trying to run this code and it's giving this error... what is the solution for this problem? import collections import multiprocessing import os import

I'm trying to run this code and it's giving this error... what is the solution for this problem?

import collections import multiprocessing import os import time from pprint import pprint

Scientist = collections.namedtuple('Scientest', [ 'name', 'field', 'born', 'nobel', ]) scientists = ( Scientist(name = 'Ada Lovelace', field = 'math', born = '1815', nobel = False), Scientist(name = 'Emmy Noether', field = 'math', born = '188255', nobel = False), Scientist(name = 'Marie Curie', field = 'physics', born = '1867', nobel = True), Scientist(name = 'Tu Youyou', field = 'chemistry', born = '1930', nobel = True), Scientist(name = 'Ada Yonath', field = 'chemistry', born = '1939', nobel = True), Scientist(name = 'Vera Rubin', field = 'astronomy', born = '1928', nobel = False), Scientist(name = 'Sally Ride', field = 'physics', born = '1951', nobel = False), )

print(scientists) print()

def transform(x): print(f'Process {os.getegid()} working record {x.name}') time.sleep(1) result = {'name': x.name, age: 2023 - x.born} print(f'Process {os.getegid()} done processing record {x.name}') return result

start = time.time() pool = multiprocessing.Pool(processes= 3) result = pool.map(transform, scientists)

end = time.time() print(f' Time to complete: {end - start: .2f}s ') print(result)

image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Understanding Databases Concepts And Practice

Authors: Suzanne W Dietrich

1st Edition

1119827949, 9781119827948

More Books

Students also viewed these Databases questions

Question

What does this public know about your organization?

Answered: 1 week ago