Please write a function named count_matching_elements (my_matrix: list, element: int), which takes a two-dimensional array of integers and a single integer value as its arguments. The function then counts how many elements within the matrix match the argument value. An example of how the function should work: m = [[1, 2, 1], [0, 3, 4], [1, 0, 0]] print (count_matching_elements (m, 1)) 3 Sample output

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter8: Arrays
Section: Chapter Questions
Problem 9PE
icon
Related questions
Question

Can you use Python programming language to to this question?

Thanks

Please write a function named count_matching_elements
(my_matrix: list, element:
int), which takes a two-dimensional array of integers and a single integer value as its
arguments. The function then counts how many elements within the matrix match the
argument value.
An example of how the function should work:
m = [[1, 2, 1], [0, 3, 4], [1, 0, 0]]
print (count_matching_elements (m, 1))
3
Sample output
Transcribed Image Text:Please write a function named count_matching_elements (my_matrix: list, element: int), which takes a two-dimensional array of integers and a single integer value as its arguments. The function then counts how many elements within the matrix match the argument value. An example of how the function should work: m = [[1, 2, 1], [0, 3, 4], [1, 0, 0]] print (count_matching_elements (m, 1)) 3 Sample output
Expert Solution
steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Binary Search Algorithm
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning