Question: 1 2 3 4 5676 910 11 12 13 14 15 16 2 3 5 7 11 13 (4) Write the Python program to

1 2 3 4 5676 910 11 12 13 14 15 16 




1 2 3 4 5676 910 11 12 13 14 15 16 2 3 5 7 11 13 (4) Write the Python program to compute what elements in any 2D array have exactly two positive factors. If the element value is 7, the factors are: [1, 7] and the number of factors is 2, then included in the output. If the element value is 9, the factors are: (1, 3, 9), then the number of factors is 3, therefore 9 is not included in the output. For instance, if the array is: [[1,2,3,4],[5,6,7,8],[9,10,11,12],[13,14,15,16]] the output is [2,3,5,7,11,13]; these are array elements that has exactly two factors (one and the element itself). Hint: you can use the reminder module operator % to determine if an element k is divisible by a factor "i", i.e., the condition k%i==0 must be True. Other methods are welcome.

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 Programming Questions!