Posts by Douglas Rodrigues • 1 point
4 posts
-
0
votes2
answers720
viewsA: Add elements of the first matrix to those of the second matrix in Python
I did it that way: Credits: Introduction to Computer Science Python USP/Coursera By Fabio Kon Sum of matrices def cria_matriz(n_linhas, n_colunas, valor): matriz = [] # Lista Vazia para matriz for x…
pythonanswered Douglas Rodrigues 1 -
0
votes4
answers6292
viewsA: Recover matrix dimensions in Python
Look I did it this way, it’s not the best, though, functional:` def dimensoes(matriz): colunas = 0 linhas = 0 qtd_colunas = 0 a = '' for i in range(len(matriz)): linhas = linhas + 1 # soma a qtd de…
pythonanswered Douglas Rodrigues 1 -
-2
votes9
answers23719
viewsA: Inverting sequence (PYTHON 3)
This solution is working, however, not the most optimized. def inverte_ordem(): lista = [] l2 = [] n = 1 i = 0 while n != 0: n = int(input('Digite um numero: ')) lista.append(n) i = len(lista) i = i…
pythonanswered Douglas Rodrigues 1 -
-1
votes5
answers13183
viewsA: Python - NIM game
def main(): print(') print('Welcome to the NIM game! Choose:') print(') n = None while True: print('1 - for isolated departure:') print('2 - for championship') n = int(input(')) if n == 1: print('…
pythonanswered Douglas Rodrigues 1