diff --git a/assignment_1.py b/assignment_1.py index ad78373..90bdc14 100644 --- a/assignment_1.py +++ b/assignment_1.py @@ -15,8 +15,9 @@ def lower_case(string): """ - ### your code starts here + ### your code starts here + lower_string = string.lower() ### your code ends here return lower_string @@ -38,6 +39,7 @@ def upper_case(string): """ ### your code starts here + upper_string = string.upper() ### your code ends here diff --git a/assignment_2a.py b/assignment_2a.py index 1b8fc0e..a370b26 100644 --- a/assignment_2a.py +++ b/assignment_2a.py @@ -10,9 +10,9 @@ just give a correct one. """ -var_1 = function_2c(...) +var_1 = function_2c(1000,100,100,-50)["add"] -var_2 = function_2b(...) +var_2 = function_2b("Seminars","Borrel")["C"] if var_1 == 950: print("Good job!") diff --git a/assignment_2b.py b/assignment_2b.py index 1aef416..1453142 100644 --- a/assignment_2b.py +++ b/assignment_2b.py @@ -5,6 +5,25 @@ No cheating! Don't show or tell hem the code directly """ def function_2b(string_1, string_2): + """ + Takes two strings and returns a dictionary of 3 strings. string_1 in lowercase. String_2 in uppercase. + A third string which is the concatenation of the operations on string_1 and string_2. + + + Parameters + ---------- + string_1: str + a string to convert to all lowercase + string_2: str + a string to convert to all uppercase + + Returns + ---------- + dict : dict + a dictionary with keys: "L","U","C" + contains string_1 in lowercase, string_2 in uppercase and the concatenation of string_1 and string_2 respectively + + """ lower = string_1.lower() upper = string_2.upper() @@ -15,3 +34,4 @@ def function_2b(string_1, string_2): "C": combined} return dict + \ No newline at end of file diff --git a/assignment_2c.py b/assignment_2c.py index 1ac1ced..0d32570 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): + """ + Takes 4 integers w,x,y and z. Returns a dictionary containing multiplication, division, addition + and subtraction on these integers. + + + Parameters + ---------- + w : int + integer + x : int + integer + y : int + integer + z : integer + + Returns + ---------- + results : dict + a dictionary with keys: "multiply","divide","add", "subtraction" + contains multiplication of x,y; division of x,y; addition of w,z; subtraction of w,z respectively. + + """ multiplication = x * y division = x / y