Posts by Marcos • 11 points
1 post
-
0
votes0
answers36
viewsQ: How to count occurrences of a number in a matrix?
I need to do a function that counts how many times a number appears in a matrix, example: ocorrencias(9,[[9,7,6,9,8,8]]) Must return 2 My code: def ocorrencias(numero,matriz): cont = 0 for elemento…