From e78e4a492fe527d30355d7cfce26a59556a2c7b0 Mon Sep 17 00:00:00 2001 From: Tijnschickendantz Date: Thu, 29 Sep 2022 16:22:37 +0200 Subject: [PATCH 1/4] to lower function --- assignment_1.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assignment_1.py b/assignment_1.py index ad78373..d7b75fd 100644 --- a/assignment_1.py +++ b/assignment_1.py @@ -16,7 +16,7 @@ def lower_case(string): """ ### your code starts here - + lower_string = string.lower() ### your code ends here return lower_string From 2822f6fc1fd34a3e27468d32050232ab45f8c4eb Mon Sep 17 00:00:00 2001 From: SesswireD Date: Thu, 29 Sep 2022 16:24:22 +0200 Subject: [PATCH 2/4] Finished lower_case and upper_case functions --- assignment_1.py | 5 ++--- assignment_2b.py | 6 ++++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/assignment_1.py b/assignment_1.py index ad78373..8c82596 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 @@ -38,6 +36,7 @@ def upper_case(string): """ ### your code starts here + upper_string = string.upper() ### your code ends here diff --git a/assignment_2b.py b/assignment_2b.py index 1aef416..61564d8 100644 --- a/assignment_2b.py +++ b/assignment_2b.py @@ -5,6 +5,9 @@ No cheating! Don't show or tell hem the code directly """ def function_2b(string_1, string_2): + """ + + """ lower = string_1.lower() upper = string_2.upper() @@ -15,3 +18,6 @@ def function_2b(string_1, string_2): "C": combined} return dict + + +print(function_2b("string 1", "EN de 2de")) \ No newline at end of file From 4e3fca648ae62f0d1832bf487920a23f0c932f3b Mon Sep 17 00:00:00 2001 From: SesswireD Date: Wed, 5 Oct 2022 12:31:02 +0200 Subject: [PATCH 3/4] Added documentation to function_2a and function_2b --- assignment_2b.py | 22 ++++++++++++++++++---- assignment_2c.py | 22 ++++++++++++++++++++++ 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/assignment_2b.py b/assignment_2b.py index 61564d8..ba525e5 100644 --- a/assignment_2b.py +++ b/assignment_2b.py @@ -6,7 +6,23 @@ """ 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 L and U respectively + """ lower = string_1.lower() @@ -18,6 +34,4 @@ def function_2b(string_1, string_2): "C": combined} return dict - - -print(function_2b("string 1", "EN de 2de")) \ No newline at end of file + \ No newline at end of file diff --git a/assignment_2c.py b/assignment_2c.py index 1ac1ced..6fbb39b 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 From 01890a56fc02d6dc73126fa140646e9b1fa5ef36 Mon Sep 17 00:00:00 2001 From: SesswireD Date: Wed, 5 Oct 2022 12:47:24 +0200 Subject: [PATCH 4/4] Solved assignment_2a --- assignment_2a.py | 4 ++-- assignment_2b.py | 2 +- assignment_2c.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) 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 ba525e5..1453142 100644 --- a/assignment_2b.py +++ b/assignment_2b.py @@ -21,7 +21,7 @@ def function_2b(string_1, string_2): ---------- dict : dict a dictionary with keys: "L","U","C" - contains string_1 in lowercase, string_2 in uppercase and the concatenation of L and U respectively + contains string_1 in lowercase, string_2 in uppercase and the concatenation of string_1 and string_2 respectively """ diff --git a/assignment_2c.py b/assignment_2c.py index 6fbb39b..0d32570 100644 --- a/assignment_2c.py +++ b/assignment_2c.py @@ -5,7 +5,7 @@ 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.