Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/Seminars.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added __pycache__/assignment_2b.cpython-36.pyc
Binary file not shown.
Binary file added __pycache__/assignment_2c.cpython-36.pyc
Binary file not shown.
10 changes: 3 additions & 7 deletions assignment_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ def lower_case(string):

"""

### your code starts here

### your code ends here
lower_string = string.lower()

return lower_string

Expand All @@ -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
6 changes: 3 additions & 3 deletions assignment_2a.py
Original file line number Diff line number Diff line change
Expand Up @@ -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!")
Expand Down
15 changes: 14 additions & 1 deletion assignment_2b.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -13,5 +27,4 @@ def function_2b(string_1, string_2):
dict = {"L": lower,
"U": upper,
"C": combined}

return dict
22 changes: 22 additions & 0 deletions assignment_2c.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down