diff --git a/assignment_1.py b/assignment_1.py index ad78373..ed4eb8f 100644 --- a/assignment_1.py +++ b/assignment_1.py @@ -16,7 +16,8 @@ def lower_case(string): """ ### your code starts here - + lower_string = string.lower() + ### your code ends here return lower_string @@ -34,11 +35,12 @@ def upper_case(string): Returns: upper_string -- upper case version of string - + """ ### your code starts here - + upper_string = upper(string) + ### your code ends here return upper_string diff --git a/assignment_2a.py b/assignment_2a.py index 1b8fc0e..01ce54d 100644 --- a/assignment_2a.py +++ b/assignment_2a.py @@ -10,9 +10,12 @@ just give a correct one. """ -var_1 = function_2c(...) -var_2 = function_2b(...) +var_1 = function_2c(1000,5,10,-50)['add'] + +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..f6d9562 100644 --- a/assignment_2b.py +++ b/assignment_2b.py @@ -5,7 +5,18 @@ No cheating! Don't show or tell hem the code directly """ def function_2b(string_1, string_2): + ''' + function_2b + inputs: + - string_1 (str) + - string_2 (str) + outputs: + - dictionary with: + - C: string_1 and string_2 appended + - L: string_1 in lower case + - U: string_2 in upper case + ''' lower = string_1.lower() upper = string_2.upper() combined = string_1 + string_2 diff --git a/assignment_2c.py b/assignment_2c.py index 1ac1ced..9a44c5b 100644 --- a/assignment_2c.py +++ b/assignment_2c.py @@ -5,7 +5,20 @@ No cheating! Don't show or tell hem the code directly """ def function_2c(w, x, y, z): + """ + This function does various mathematical operations: multiplication, division, + addition and subtraction + Input: + w: float, will be multiplied by y and added/substracted to z + x: float, will be divided by y + y: float + z: float, will be added/substracted by z + + Returns a dictionary with the results for each of the 4 operations, with keys + 'multiply', 'divide', 'add','subtract' + + """ multiplication = x * y division = x / y addition = w + z