commit b27818ced127d4b4d9da6e85caa9681cb9bfe2aa Author: Dennis <2122684@stud.hs-mannheim.de> Date: Tue Nov 8 15:31:55 2022 +0100 ... diff --git a/.project b/.project new file mode 100644 index 0000000..3a69ce4 --- /dev/null +++ b/.project @@ -0,0 +1,11 @@ + + + PR3_Steinberger + + + + + + + + diff --git a/s1_a1_3.pdf b/s1_a1_3.pdf new file mode 100644 index 0000000..c6ecd93 Binary files /dev/null and b/s1_a1_3.pdf differ diff --git a/s1_a52.pdf b/s1_a52.pdf new file mode 100644 index 0000000..2f1c1af Binary files /dev/null and b/s1_a52.pdf differ diff --git a/s1_a53_6.py b/s1_a53_6.py new file mode 100644 index 0000000..dcfbed4 --- /dev/null +++ b/s1_a53_6.py @@ -0,0 +1,60 @@ +#Aufgabe 5.3 +liste1 = [1,2,3,4,5,6,7,8,9,10] +l = liste1[len(liste1)-3 : len(liste1)] +for i in range(1,4): + x = liste1.pop() + liste1.insert(0, x) + +print(liste1) + +#Aufgabe 5.4 +from xmlrpc.client import boolean +from pickle import TRUE +list1 = [] +string1 = "Donaudampfschifffahrtsgesellschaft".lower() +list1.extend(string1) +count = 0 +print("Laenge der Liste vorher: ", len(list1)) + +i = 0 +while i < len(list1): + element = list1[i] + count = list1.count(element) + if count > 1: + i = 0 + for j in range(1,count+1): + list1.remove(element) + + else: + i = i+1 + +print("Laenge der Liste nachher: ", len(list1)) + + +#Aufgabe 5.5 +list1 = [[1,2,3],[2,1,3],[4,0,1]] +i = 0 +while i < len(list1)-1: + save_string = list1[i] + if list1[i+1][1] < list1[i][1]: + list1[i] = list1[i+1] + list1[i+1] = save_string + i = 0 + else: + i = i+1 + +print(list1) + +#Aufgabe 5.6 +geraeusch = { + "Hund" : "Wuff", + "Katze":"Miau", + "Esel" : "Ia" + } + +def tier_geraeusch(tiername): + print(geraeusch[tiername]) + + +tier_geraeusch("Hund") + \ No newline at end of file diff --git a/si_a4.py b/si_a4.py new file mode 100644 index 0000000..afb9c17 --- /dev/null +++ b/si_a4.py @@ -0,0 +1,17 @@ +from cmath import pi + +END_CONDITION = (pi**2)/6 +sum = 0 +i = 1 +counter = 0 + +while(True): + sum = sum + (1/(i**2)) + if('%.6f'%sum == '%.6f'%END_CONDITION): + print('%.6f'%sum) + break + i = i+1 + counter = counter +1 + +print('Anzahl der Iterationen: ', counter) +