Aufgabe 5 vollendet

master
Ni-o-iN 2022-05-03 21:58:03 +02:00
parent b787c6d204
commit 5dcd9660ef
1 changed files with 12 additions and 13 deletions

View File

@ -1,18 +1,17 @@
import numpy as np #Aufgabe 1a)
a=np.array([[3,0,-2,11],[0,0,9,0],[0,7,0,0],[0,0,0,-3]]) my_list = [[3,0,-2,11],[0,0,9,3],[0,7,0,0],[0,0,0,-3]]
print(a) #Aufgabe 1b)
#my_list = [[], [], [], []]
#MAX_LENGTH = 4
#for i in range(0, MAX_LENGTH):
# for j in range(0, MAX_LENGTH):
# n = int(input("Enter n:"))
# my_list[i].insert(j, n)
#
# print(my_list)
my_list = [[], [], [], []] #Aufgabe 1d)
MAX_LENGTH = 4
for i in range(0, MAX_LENGTH):
for j in range(0, MAX_LENGTH):
n = int(input("Enter n:"))
my_list[i].insert(j, n)
print(my_list)
print()
for i, row in enumerate(my_list): for i, row in enumerate(my_list):
for j, item in enumerate(row): for j, item in enumerate(row):
print(f'a[{i}] [{j}] = {item} ', end=' ') print(f'a[{i}] [{j}] = {item} ', end=' ')