Teil 6 "Objekte ist neu
Repository aufgeräumt.
This commit is contained in:
7
teil5/lists/append.py
Normal file
7
teil5/lists/append.py
Normal file
@@ -0,0 +1,7 @@
|
||||
namen = ["Homer", "Marge", "Bart"]
|
||||
|
||||
|
||||
namen.append('Lisa')
|
||||
namen.append('Maggie')
|
||||
|
||||
print(namen)
|
9
teil5/lists/del.py
Normal file
9
teil5/lists/del.py
Normal file
@@ -0,0 +1,9 @@
|
||||
zahlen1 = ['0','1','4','3','2','5']
|
||||
zahlen2 = ['8','7','9','6']
|
||||
|
||||
zahlen1.extend(zahlen2)
|
||||
|
||||
print(f'komplett:{zahlen1}')
|
||||
zahlen1.sort()
|
||||
del zahlen1[3]
|
||||
print(f'nach del:{zahlen1}')
|
6
teil5/lists/extend.py
Normal file
6
teil5/lists/extend.py
Normal file
@@ -0,0 +1,6 @@
|
||||
zahlen1 = ['0','1','2','3','4','5']
|
||||
zahlen2 = ['6','7','8','9']
|
||||
|
||||
zahlen1.extend(zahlen2)
|
||||
|
||||
print(zahlen1)
|
4
teil5/lists/iter_namen.py
Normal file
4
teil5/lists/iter_namen.py
Normal file
@@ -0,0 +1,4 @@
|
||||
namen = ["Homer", "Marge", "Bart"]
|
||||
|
||||
for ind in range(0,len(namen)):
|
||||
print(f'{ind}: {namen[ind]}')
|
5
teil5/lists/namen.py
Normal file
5
teil5/lists/namen.py
Normal file
@@ -0,0 +1,5 @@
|
||||
namen = ["Homer", "Marge", "Bart"]
|
||||
|
||||
print(namen[0])
|
||||
print(namen[1])
|
||||
print(namen[2])
|
8
teil5/lists/sort.py
Normal file
8
teil5/lists/sort.py
Normal file
@@ -0,0 +1,8 @@
|
||||
zahlen1 = ['0','1','4','3','2','5']
|
||||
zahlen2 = ['8','7','9','6']
|
||||
|
||||
zahlen1.extend(zahlen2)
|
||||
|
||||
print(f'unsortiert:{zahlen1}')
|
||||
zahlen1.sort()
|
||||
print(f'sortiert:{zahlen1}')
|
Reference in New Issue
Block a user