Added
parent
5331d3c332
commit
70dc927403
Binary file not shown.
|
@ -0,0 +1,4 @@
|
|||
import numpy as np
|
||||
a=np.array([[3,0,-2,11],[0,0,9,0],[0,7,0,0],[0,0,0,-3]])
|
||||
|
||||
print(a)
|
Binary file not shown.
|
@ -0,0 +1,48 @@
|
|||
print("Aufgabe 3:")
|
||||
|
||||
liste = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
||||
|
||||
print("Liste: ", liste)
|
||||
|
||||
a = liste[-1]
|
||||
b = liste[-2]
|
||||
c = liste[-3]
|
||||
|
||||
liste = [a] + liste
|
||||
liste = [b] + liste
|
||||
liste = [c] + liste
|
||||
|
||||
for x in range(3):
|
||||
liste.pop(-1)
|
||||
|
||||
print("Liste neu:", liste)
|
||||
|
||||
print()
|
||||
print("Aufgabe 4:")
|
||||
|
||||
strings="Donaudampfschiffahrtsgesellschaftsstewardess"
|
||||
x=list(strings)
|
||||
|
||||
resultantList = []
|
||||
|
||||
print(x)
|
||||
|
||||
print("Länge der Liste:", len(x))
|
||||
|
||||
for element in strings:
|
||||
if element not in resultantList:
|
||||
resultantList.append(element)
|
||||
|
||||
print(resultantList)
|
||||
|
||||
print("Länge der Liste ohne Duplikate:", len(resultantList))
|
||||
|
||||
print()
|
||||
print("Aufgabe 5:")
|
||||
|
||||
def sort(sub_li):
|
||||
sub_li.sort(key = lambda x: x[1])
|
||||
return sub_li
|
||||
|
||||
sub_li =[[1, 2, 3], [2, 1, 3], [4, 0, 1]]
|
||||
print(sort(sub_li))
|
|
@ -0,0 +1,9 @@
|
|||
s = "This is a test"
|
||||
new_s = s.replace(' ','-')
|
||||
print(new_s)
|
||||
|
||||
s1 = "Hello, World"
|
||||
|
||||
s1split = s1.split(",")
|
||||
|
||||
print(''.join(reversed(s1split)))
|
Reference in New Issue