Skip to content

Instantly share code, notes, and snippets.

@acwoss
Created August 16, 2018 01:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save acwoss/8f4a29606036cd7f6e1d3f315269d0fb to your computer and use it in GitHub Desktop.
Save acwoss/8f4a29606036cd7f6e1d3f315269d0fb to your computer and use it in GitHub Desktop.
TrustyDistortedExecutable created by acwoss - https://repl.it/@acwoss/TrustyDistortedExecutable
import numpy
dimensions = input('Dimensões da matriz NxM: ').split()
N, M = [int(value) for value in dimensions]
matrix = []
for i in range(N):
row = input(f'Linha {i+1}: ').split()
if len(row) != M:
raise Exception(f'Você precisa informar {M} valores por linha')
numbers = [int(number) for number in row]
matrix.append(numbers)
matrix = numpy.matrix(matrix)
print(matrix)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment