Question: Given a function called prime(n) that returns True if n is prime, False otherwise, write a function called single prime(di) that takes a dictionary as

 Given a function called prime(n) that returns True if n is prime, False otherwise, write a function called single prime(di) that takes a dictionary as an argument. The keys and values of the dictionary will be integers greater than one. The function should return a new dictionary that contains the key-value pairs in di where either the key is prime or the value is prime, but not both. For example, if di is {2 : 10, 5 : 18, 8 : 7, 13 : 23, 3 : 12, 10 : 4, 17, 31} the function should return {2 : 10, 5 : 18, 8 : 7, 3 : 12} Note that you can assume the prime() function already exists;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!