From 5dcd9660ef2e3f2ba3c6f392f4e2e0808a8481d0 Mon Sep 17 00:00:00 2001 From: Ni-o-iN Date: Tue, 3 May 2022 21:58:03 +0200 Subject: [PATCH] Aufgabe 5 vollendet --- python/s1/s1_a51.py | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/python/s1/s1_a51.py b/python/s1/s1_a51.py index 5c9fc9f..93de484 100644 --- a/python/s1/s1_a51.py +++ b/python/s1/s1_a51.py @@ -1,18 +1,17 @@ -import numpy as np -a=np.array([[3,0,-2,11],[0,0,9,0],[0,7,0,0],[0,0,0,-3]]) +#Aufgabe 1a) +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 = [[], [], [], []] -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() +#Aufgabe 1d) for i, row in enumerate(my_list): for j, item in enumerate(row): print(f'a[{i}] [{j}] = {item} ', end=' ')