Question: In PYTHON, Exercise #2: Design and implement a program (name it CompareArrays) that compares the content of 2 single-dimensional arrays of the same size. The
In PYTHON,
Exercise #2: Design and implement a program (name it CompareArrays) that compares the content of 2 single-dimensional arrays of the same size. The program prompts the users to enter the array size. Then prompts the user to initialize each array with integer values. The program defines method Compare() that takes two signal-dimensional arrays of type integer. The method compares the content of the arrays and returns true (Boolean type) if the arrays store same values in the same order. Otherwise, it returns false. The program main method calls method Compare()and prints the result from the method as shown below. Document your code and organized your output following these sample runs.
Sample run 1:
Array size: 4
First array: 23, -45, 78, 10
Second array: 23, -45, 78, 10 Judgment: The arrays are identical
Sample run 2:
Array size: 5
First array: 78, 128, 300, 12, 300
Second array: 78, 128, 12, 300, 300 Judgment: The arrays are not identical
Sample run 3:
Array size: 1
First array: 0
Second array: 0 Judgment: The arrays are identical
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
