-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex086.py
More file actions
23 lines (20 loc) · 710 Bytes
/
ex086.py
File metadata and controls
23 lines (20 loc) · 710 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
'''
Exercício 086
Crie um programa que crie uma matriz de dimensão 3x3 e preencha
com valores lidos pelo teclado. No final, mostre a matriz na tela,
com a formatação correta.
'''
matriz = []
# Repetição dentro de repetição, pois uma matriz 3x3 tem:
# 3 linhas e 3 colunas, assim: 9 elemtentos e duas repetições, aninhadas.
for l in range(0, 3):
for c in range(0, 3):
matriz[l][c] = int(input(f'Digite um número para [{l}, {c}]: '))
print('-' * 30)
print(f'======{" MATRIZ 3 X 3 ":^4}=====')
for l in range(0, 3):
for c in range(0, 3):
print(f'( {matriz[l][c]:^5} ) ', end='')
# Quando o número de colunas finalizar, será pulado uma linha
print()
print('-' * 30)