commit d2c39984fd4ada1e6e630f23084cc956997e7592 Author: Loosen-IT Date: Fri Nov 10 14:21:06 2023 +0100 * diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/jupyter-settings.xml b/.idea/jupyter-settings.xml new file mode 100644 index 0000000..fa111dc --- /dev/null +++ b/.idea/jupyter-settings.xml @@ -0,0 +1,25 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..8961d95 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..614b3c1 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/python.iml b/.idea/python.iml new file mode 100644 index 0000000..74d515a --- /dev/null +++ b/.idea/python.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/ha_01/loosen_janniclas_1540907_02.py b/ha_01/loosen_janniclas_1540907_02.py new file mode 100644 index 0000000..ff8bb4c --- /dev/null +++ b/ha_01/loosen_janniclas_1540907_02.py @@ -0,0 +1,52 @@ +# Author: Jan-Niclas Loosen +# Matrikelnummer: 1540907 + +# AUFGABE 0 +def pi(run=1000): + return 4 * pi_quarter(run) + + +def pi_quarter(run=1000): + ret = 1 + for i in range(run): + add = 3 + i*2 + if i%2 == 0: + ret -= 1 / add + else: + ret += 1 / add + return ret + + +# example for main routine +print("pi/4: "+str(pi_quarter())) +print("pi: "+str(pi())+"\n") + + +# AUFGABE 02 +def convert_to_f(deg): + return round(deg * (9/5) + 32, 2) + + +def convert_to_c(deg): + return round((deg-32) * (5/9), 2) + + +def dialog(): + deg = input("Degrees: ") + mode = input("convert to fahrenheit (0) or convert to celsius (1): ") + try: + if mode == "0": + print(str(convert_to_f(float(deg))) + "\n") + elif mode == "1": + print(str(convert_to_c(float(deg))) + "\n") + else: + print("invalid mode\n") + except Exception: + print("invalid input\n") + + +# example for main routine +again = input("convert (1) or exit (other inputs): ") +while again == "1": + dialog() + again = input("convert (1) or exit (other inputs): ") \ No newline at end of file diff --git a/ueb_01/aufgabe_02.py b/ueb_01/aufgabe_02.py new file mode 100644 index 0000000..fadbc15 --- /dev/null +++ b/ueb_01/aufgabe_02.py @@ -0,0 +1,2 @@ +for i in range(3): + print("Hello World!") \ No newline at end of file diff --git a/ueb_01/aufgabe_03.py b/ueb_01/aufgabe_03.py new file mode 100644 index 0000000..6aec0fe --- /dev/null +++ b/ueb_01/aufgabe_03.py @@ -0,0 +1,23 @@ +def odd(x=500): + for i in range(x): + if i%2 == 1: + print(i) + + +def even(x=500): + for i in range(x): + if i%2 == 0: + print(i) + + +def indicator(x=500): + for i in range(x): + if i%2 == 0: + print(1) + else: + print(-1) + + +# odd(10) +# even(10) +indicator(10) \ No newline at end of file diff --git a/ueb_02/aufgabe_01.py b/ueb_02/aufgabe_01.py new file mode 100644 index 0000000..fb7320f --- /dev/null +++ b/ueb_02/aufgabe_01.py @@ -0,0 +1,11 @@ +def lang(str): + str = list(str) + set = ["a","e","i","o","u"] + for i in range(1,len(str)): + if str[i] == "h" and str[i-1] in set: + str[i] = str[i-1] + return "".join(str) + + +str = input("Word: ") +print("Translation: "+lang(str)) \ No newline at end of file