diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..bd675cb --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +assignment_2b.py \ No newline at end of file diff --git a/.idea/Seminars.iml b/.idea/Seminars.iml new file mode 100644 index 0000000..8a05c6e --- /dev/null +++ b/.idea/Seminars.iml @@ -0,0 +1,12 @@ + + + + + + + + + + \ No newline at end of file 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/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..d1e22ec --- /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..3ce774c --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/__pycache__/assignment_2b.cpython-36.pyc b/__pycache__/assignment_2b.cpython-36.pyc new file mode 100644 index 0000000..8edc271 Binary files /dev/null and b/__pycache__/assignment_2b.cpython-36.pyc differ diff --git a/__pycache__/assignment_2c.cpython-36.pyc b/__pycache__/assignment_2c.cpython-36.pyc new file mode 100644 index 0000000..fc7a8ef Binary files /dev/null and b/__pycache__/assignment_2c.cpython-36.pyc differ diff --git a/assignment_1.py b/assignment_1.py index 166ef54..2fce717 100644 --- a/assignment_1.py +++ b/assignment_1.py @@ -15,9 +15,7 @@ def lower_case(string): """ - ### your code starts here - - ### your code ends here + lower_string = string.lower() return lower_string @@ -37,8 +35,6 @@ def upper_case(string): """ - ### your code starts here - - ### your code ends here + upper_string = string.upper() - return lower_string + return upper_string diff --git a/assignment_2a.py b/assignment_2a.py index 529aceb..d50d7e9 100644 --- a/assignment_2a.py +++ b/assignment_2a.py @@ -9,11 +9,11 @@ just give a correct one. """ -var_1 = function_2b(...) +var_1 = function_2c(1000, 5, 10, -50)["add"] -var_2 = function_2c(...) +var_2 = function_2b("Seminars", "Borrel")["C"] -var_3 = str(function_2b(...)) + function_2c(...) +var_3 = str(function_2c(5, 10, 1000, 10)["multiply"]) + function_2b("CLS", "cLs")["L"] if var_1 == 950: print("Good job!") diff --git a/assignment_2b.py b/assignment_2b.py index 1aef416..af3dfb8 100644 --- a/assignment_2b.py +++ b/assignment_2b.py @@ -5,6 +5,20 @@ No cheating! Don't show or tell hem the code directly """ def function_2b(string_1, string_2): + """ + given parameters + string_1 : string given as first given parameter + string_2 : string given as second given parameter + + parameters made in function + lower : First string parameter in lower cases + upper: Second string parameter in upper cases + combined : A string of string_1 and string_2 combined + + returned values: + dict : is a dictionary with keys "L", "U" and "C" with values lower, upper and combined + respectively + """ lower = string_1.lower() upper = string_2.upper() @@ -13,5 +27,4 @@ def function_2b(string_1, string_2): dict = {"L": lower, "U": upper, "C": combined} - return dict diff --git a/assignment_2c.py b/assignment_2c.py index 1ac1ced..592af8e 100644 --- a/assignment_2c.py +++ b/assignment_2c.py @@ -5,6 +5,28 @@ No cheating! Don't show or tell hem the code directly """ def function_2c(w, x, y, z): + """ Performs multiplication, division, addition and subtraction on the input values. + Parameters + ---------- + w + A value to either add to z or from which z is subtracted + x + A value to either multiply by value y or which is divided by y + y + A value to either multiply by value x or divide x by + z + A value to add to w or to subtract from w + + multiplication = x * y + division = x / y + addition = w + z + subtraction = w - z + + Returns + ------- + A dictionary containing the results to the four mathematical operations on the values, with keys + "multiply", "divide", "add", "subtract". + """ multiplication = x * y division = x / y