pr3-skriptspr-gruppef-sl1/s1_a51.py

19 lines
471 B
Python
Raw Normal View History

2022-11-15 14:51:35 +01:00
# 1a
matrix_list = [[3, 0, -2, 11], [0, 0, 9, 0], [0, 7, 0, 0], [0, 0, 0, -3]]
print(matrix_list)
# 1b+c
matrix_list_general = [[], [], [], []]
MAX = 4
for i in range(0, MAX):
print("Zeile " + str(i + 1))
for j in range(0, MAX):
n = int(input("Value:"))
matrix_list_general[i].insert(j, n)
print(matrix_list_general)
# 1d
for i, row in enumerate(matrix_list_general):
for j, value in enumerate(row):
print(f'a[{i}][{j}] = {value} ')