Posts by João • 71 points
6 posts
-
0
votes1
answer34
viewsQ: Function does not work in all test cases
I need to do a function to check if a matrix is square: def eh_quadrada(matriz): '''Função que verifica se uma matriz é quadrada. list->bool''' if len(matriz)==len(matriz[0]): return True else:…
-
0
votes1
answer289
viewsQ: How to multiply all elements of an array by number in Python?
I need to do a function that given a matrix and a number, returns the resulting matrix by multiplying all elements of the matrix by that number. I tried something like this: def mult(matriz, n):…
-
0
votes1
answer51
viewsQ: need to do a function similar to a search in an agenda
Make a function that given as input a list with contact information and a string, if the string is in the list, must return contact information or contacts. Inside the entry list, you have lists…
-
1
votes2
answers177
viewsQ: How to find the umpteenth occurrence of a substring?
I need to do a function that takes as input a string, a letter, and a number that indicates the desired occurrence of the letter (1 for first occurrence, 2 for second, etc). The function needs to…
-
0
votes2
answers174
viewsQ: Find out which number from 1 to N is missing from a list with N - 1 numbers
Write a function that, given a list of N 1 integers numbered from 1 to N, finds out which integer of that range is missing. Input: The input parameter is an L list of size N 1 containing integers…
-
2
votes2
answers329
viewsQ: Function that returns uppercase consonants
the function receives a sentence as input and returns the sentence with all its consonants in uppercase. def teste(frase): i=0 while i<len(frase): if frase[i]in 'bcdfghjklmnpqrstvxwyz':…