“Crie compreensão da lista de python 2D da matriz Python” Respostas de código

2d Lista de compreensão Python

[[float(c) for c in row] for row in data]
Bored Coder

Crie compreensão da lista de python 2D da matriz Python

#by taking the user input
def main():
    #write your code here
    row = int(input())
    col  = int(input()
    
    #using the list comprehensions
    matrix = [[int(input())for j in range(col)]for j in range(row)]
    #display the matrix
    for i in range(row):
        for j in range(col):
            print(matrix[i][j],end=" ")
        print()

if __name__ == "__main__":
    main()
Combative Cardinal

2d Lista de compreensão Python


[int(x) for line in data for x in line.split()]

Smoggy Salmon

Respostas semelhantes a “Crie compreensão da lista de python 2D da matriz Python”

Perguntas semelhantes a “Crie compreensão da lista de python 2D da matriz Python”

Mais respostas relacionadas para “Crie compreensão da lista de python 2D da matriz Python” em Python

Procure respostas de código populares por idioma

Procurar outros idiomas de código