This repository has been archived on 2022-05-03. You can view files and clone it, but cannot push or open issues/pull-requests.
PR3Python/python/s1/s1_a53_6.py

48 lines
778 B
Python
Raw Normal View History

2022-05-02 20:29:56 +02:00
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))