print matrix in phyton

1

I would like to know how to print an array [[2,3],                                                        [4,6]]
for example, in the form of the bottom line without using

    
asked by anonymous 11.05.2017 / 07:04

2 answers

1

First mode

matriz = ((2, 3), (4, 6))
for linha in matriz:
    print(linha)

The result will be:

(2, 3)
(4, 6)

Second mode

matriz = ((2, 3), (4, 6))
for linha in matriz:
    for coluna in linha:
        print(coluna)

The result will be:

2
3
4
6
    
11.05.2017 / 09:01
1

This will print formatted:

matriz = [[2, 3, 4], [5, 6, 7]]
for linha in matriz:
    for coluna in linha:
        print(coluna,end='  ')
    print('\n')
    
17.05.2018 / 23:07