Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLS fork #5

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
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
8 changes: 5 additions & 3 deletions assignment_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ def lower_case(string):
"""

### your code starts here

lower_string = string.lower()

### your code ends here

return lower_string
Expand All @@ -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
7 changes: 5 additions & 2 deletions assignment_2a.py
Original file line number Diff line number Diff line change
Expand Up @@ -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!")
Expand Down
11 changes: 11 additions & 0 deletions assignment_2b.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions assignment_2c.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down