IN PYTHON ONLY !! Design (pseudocode) and implement (source code) a program (name it Occurrences) to determine whether two two-dimensional arrays are equivalent or not. Two arrays are equivalent if they contain the same values in any order. The program main method defines two two-dimensional array of size 3-by-3 of type integer, and prompts the user to enter integer values to initialize the arrays.
- The main method calls method isEquivalent()that takes two two-dimensional arrays of integer and returns true (boolean value) if the arrays contain the same values in any order, otherwise it returns false.
- Hint: use a sort method from Lab 14 in developing the solution for this problem.
- Document your code and properly label the input prompts and the outputs as shown below.
Sample run 1:
Array A:
1 2 3
4 5 6
7 8 9
Array B:
1 2 3
6 5 4
7 8 9
Judgment: The arrays are equivalent.
Sample run 2:
Array A:
1 1 1
1 5 6
1 1 1
Array B:
1 1 1
1 6 6
1 1 1
Judgment: The arrays are not equivalent.
Thanks for the question, here is the complete code in python, comments added to all important line so that you can understand whats going on
=======================================================================================
# function to check if two arrays has all the numbers in common
def isEquivalent(matrix1,matrix2):
# create a single dimensional list to store all the 9 numbers for matrix 1
numbers_one=[]
for row in matrix1:
for num in row:
numbers_one.append(num)
# once all numbers are added we sort them in ascending order
numbers_one.sort()
# create a single dimensional list to store all the 9 numbers for matrix 2
numbers_two=[]
for row in matrix2:
for num in row:
numbers_two.append(num)
# once all numbers are added we sort them in ascending order
numbers_two.sort()
# first check if both the list has 9 elements
# if the count is not 9 we return False
if len(numbers_one) is not 9 or len(numbers_two) is not 9:
return False
# for each index we compare both numbers in both the list
# if for an index the number dont match we immediately return False
for i in range(len(numbers_one)):
if numbers_one[i] is not numbers_two[i]:
return False
# if all check passes we finally return True
return True
m1=[[1,2,3],[4,5,6],[7,8,9]]
m2=[[1,7,8],[2,6,3],[4,5,11]]
if (isEquivalent(m1,m2)):
print('Judgement: The arrays are equivalent.')
else:
print('Judgement: The arrays are not equivalent.')
==========================================================================================

thanks !
IN PYTHON ONLY !! Design (pseudocode) and implement (source code) a program (name it Occurrences) to...
In pseudocode only Design (pseudocode) a program (name it Occurrences) to determine whether two two-dimensional arrays are equivalent or not. Two arrays are equivalent if they contain the same values in any order. The program main method defines two two-dimensional array of size 3-by-3 of type integer, and prompts the user to enter integer values to initialize the arrays. The main method calls method isEquivalent()that takes two two-dimensional arrays of integer and returns true (boolean value) if the arrays contain...
IN PYTHON WITHOUT USING: .APPEND/ .SORT/ INSERT / .SPLIT Program 1: Design (pseudocode) and implement (source code) a program (name it Occurrences) to determine whether two two-dimensional arrays are equivalent or not. Two arrays are equivalent if they contain the same values in any order. The program main method defines two two-dimensional array of size 3-by-3 of type integer, and prompts the user to enter integer values to initialize the arrays. The main method calls method isEquivalent()that takes two two-dimensional...
C++Implement only (source code) a program to determine whether two two-dimensional arrays are equivalent or not. Two arrays are equivalent if they contain the same values in any order. The program main method defines two two-dimensional array of size 3-by-3 of type integer, and prompts the user to enter integer values to initialize the arrays. The main method calls method isEquivalent()that takes two two-dimensional arrays of integer and returns true (boolean value) if the arrays contain the same values in...
SOLVE 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...
PLEASE DO THE PSEUDOCODE FOR THE PROGRAM BELOW Program 3: Design (pseudocode) and implement (source code) a program (name it DistinctValues) to display only district values in an array. The program main method defines a single-dimensional array of size 10 elements and prompts the user to enter 10 integers to initialize the array. The main method then calls method getValues() that takes an integer array and returns another single-dimensional array containing only distinct values in the original (passed) array. Document...
PSEUDOCODE and PYTHON source code! Program 4: Design (pseudocode) and implement (source code) a program (name it MinMaxAvg) to determine the highest grade, lowest grade, and the average of all grades in a 4-by-4 two-dimensional arrays of integer grades (representing 4 students’ grades on 4 tests). The program main method populates the array (name it Grades) with random grades between 0 and 100 and then displays the grades as shown below. The main method then calls method minMaxAvg()that takes a...
Note: According to the question, please write source
code in java only using the class method. Sample Run (output)
should be the same as displayed in the question below. Make sure
the source code is working properly and no errors.
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...
C# ONLY INCLUDE BOTH PSUDEO CODE AND SOURCE CODE!!!! Design (pseudocode) and implement (source code) a program (name it IndexOfLargest) to find the index of the first largest value in the array. Note that the largest value may appear more than once in the array. The program main method defines a single-dimensional array of size 10 elements and prompts the user to enter 10 integers to initialize the array. The main method then calls method findIndex() that takes a single-dimensional...
PLEASE DO IN C# AND MAKE SURE I CAN COPY CODE INTO VISUAL STUDIO 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...
Design in Python (pseudocode) and implement (source code) a program (name it MyRectangle) that defines the following 3 methods: Method isValid() returns true if the sum of the width and height is greater than 30 Method Area() returns the area of the rectangle if it is a valid rectangle Method Perimeter() returns the perimeter of the rectangle if it is a valid rectangle The main method of MyRectangle prompts the user to enter the width and height of a rectangle...